finding specific immediate children of an element using prototype
- by tatilans
Following DOM structure:
<ul>
<li class="item">yes</li>
<li>no</li>
<li class="item">yes</li>
<li>
<ul>
<li class="item">no</li>
</ul>
</li>
</ul>
Assuming I have the outer <ul> in $ul. How do I get the two immediate children which have the item-class?
In jQuery I would write something like this:
$ul.children().filter(".item")
$ul.children(".item")
$ul.find("> .item")
How do I to this with Prototype?
I tried the following ...
$ul.select("> .item") //WRONG
... but it does does exactly the opposite and returns the one inner <li>