In the example below id's (first_li, second_li, etc) are only used for debugging purposes.

http://www.appelsiini.net/~tuupola/jquery/bugs/click-1.1.2.html

I have nested lists. When clicking li element of parent list it sibling ul will be hidden and shown. This works as expected.

Problem is clicking li element in sibling list will hide sibling (itself). Loggin to console shows (check element id) that the click event was fired on parent element.

Question is, is the click event leaking out from sibling or is this expected behaviour?

-cut-
  $("ul.style3 > li").bind("click", function(e) {
      e.preventDefault();
      $(this).children("ul").slideToggle(50);
      console.log(this);
  });
-cut-

-cut-
  <ul class="style3" style="margin-bottom:5px;">
      <li id="first_li"><a href="#">Lorem ipsum</a>
          <ul class="style4">
              <li><a href="#">Proin egestas urna</a></li>
              <li><a href="#">Proin urn egestas</a></li>
          </ul>
      </li>
  </ul>
-cut-

--
Mika Tuupola                      http://www.appelsiini.net/~tuupola/



Reply via email to