need to generate unlimited number of unique id's with jQuery

Posted by jquery n00b on Stack Overflow See other posts from Stack Overflow or by jquery n00b
Published on 2010-03-18T01:15:11Z Indexed on 2010/03/18 1:21 UTC
Read the original article Hit count: 336

Filed under:

Hi all, extreme n00b here... I've got a number of elements (dynamically generated by back end so it could be quite a few) and all need a unique id. I'm trying to work out how to do this wth jQuery and not doing so well. Any help is appreciated.

In the code below, I'd want each "bar" div to get a unique id, like id1, id2 etc etc

<div class="foo">
    <ul  class="bar">
</ul>
    <ul  class="bar">
</ul>
    <ul  class="bar">
</ul>
    <ul  class="bar">
</ul>
</div>

© Stack Overflow or respective owner

Related posts about jQuery