Javascript / Jquery Tree Travesal question

Posted by Copper on Stack Overflow See other posts from Stack Overflow or by Copper
Published on 2010-05-31T23:45:06Z Indexed on 2010/05/31 23:53 UTC
Read the original article Hit count: 160

Filed under:
|
|
|
|

Suppose I have the following

<ul>
<li>Item 1</li>
<li>Item 2
   <ul>
    <li>Sub Item</li>
   </ul>
</li>
<li>Item 3</li>
</ul>

This list is auto-generated by some other code (so adding exclusive id's/class' is out of the question. Suppose I have some jquery code that states that if I mouseover an li, it gets a background color. However, if I mouseover the "Sub Item" list item, "Item 2" will be highlighted as well. How can I make it so that if the user mouses over "Sub Item" it only puts a background color on that and not on "Item 2" as well?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery