Hi.

I am using JQuery 1.1.1

I have the following structure (taken from treeview) and want something
to happen when an <li> item is clicked. 

<ul>
  <li class="open">Item 3.0
    <ul>
      <li>Item 3.0.0</li>
       <li>Item 3.0.1
         <ul>
           <li>Item 3.0.1.0</li>
           <li>Item 3.0.1.1</li>
         </ul>          
       </li>
       <li>Item 3.0.2
        <ul>
         <li>Item 3.0.2.0</li>
         <li>Item 3.0.2.1</li>
         <li>Item 3.0.2.2</li>
        </ul>
       </li>
      </ul>
    </li>
   </ul>
  </li>
</ul>


This is the code when the item is clicked.

$("li").bind("click", function(){
       alert( $(this).text() ); event.stopPropagation();
});

The problem is that when I click on a leaf, not only do I get an event
for that leaf, but I get an event for each parent.

How can I stop the propogation. I tried event.stopPropagation(), but it
doesn't seem to do anything.

Thanks for any help.

Peter








_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to