finding specific immediate children of an element using prototype
Posted
by tatilans
on Stack Overflow
See other posts from Stack Overflow
or by tatilans
Published on 2010-06-02T11:59:18Z
Indexed on
2010/06/02
12:54 UTC
Read the original article
Hit count: 141
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>
© Stack Overflow or respective owner