jQuery li:has(ul) selector issue
Posted
by sushil bharwani
on Stack Overflow
See other posts from Stack Overflow
or by sushil bharwani
Published on 2010-05-31T14:47:36Z
Indexed on
2010/05/31
14:52 UTC
Read the original article
Hit count: 260
I was creating a tree using UL LI list and jQuery. I used a jQuery Selector
jQuery(li:has(ul)) to find all the list nodes having childs and then added a click event to it.
jQuery(li:has(ul)).click(function(event) {
jQuery(this).children.toggle();
jQuery(this).css("cursor","hand");
});
This works for me except i dont understand why i get a cursor hand and click event triggering even when i take mouse pointer to childs of my selected li
<li> Parent // it works here that is fine
<ul>
<li> child1 // it works here i dont understand need explanation
</li>
<li> child2 // it works here i dont understand need explanation
</li>
</ul>
</li>
© Stack Overflow or respective owner