0

I will keep it simple. I need to list id of every element in given section.
Example

<div id="leftSide">
    <ul id="leftList">
        <li id="item1"item 1</li>
        <li id="item2"item 2</li>
        <li id="item3"item 3</li>
        <li id="item4"item 4</li>
        <li id="item5"item 5</li>
        <li id="item6"item 6</li>
    </ul>
</div>
<div id="rightSide">
    <ul id="rightList">
        <li id="item2"item 2</li>
        <li id="item4"item 4</li>
        <li id="item6"item 6</li>
    </ul>
</div>

I need to get IDs for "li" items on the "rightSide" container.
How to?

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by peter_budo
2

I think I understand what you were trying to say:

var ids = [];
$('#rightList > li').each(function(el) {
  ids.push(el.id);
});
Votes + Comments
Perfect answer :)
Very helpful reply
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.