Add a different ID to each li element by jQuery

Posted by Machi on Stack Overflow See other posts from Stack Overflow or by Machi
Published on 2010-05-17T08:27:01Z Indexed on 2010/05/17 8:30 UTC
Read the original article Hit count: 342

Filed under:
|

Hi guys, I'm new here and I'd like to ask a question about jQuery.

I have the unordered list like:

<ul id="pages">
    <li class="something"><a href="#"></a></li>
    <li class="something"><a href="#"></a></li>
    <li class="something"><a href="#"></a></li>
</ul>

And I'd like to add a different ID to every li displayed in this <ul> (eg. <li class="something" id="li1">...). Is there a way how to achieve this via jQuery?

Thanks a lot, Jakub

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about unordered-list