Hi, I just had a question regarding event propagation, do events propagate up only when they're the same? Meaning if a click event happens in the child and goes up to the parent, will just the click event of the parent occur?
This one causes the alert in the parent click to happen when i click on an LI which as UL in it, Item 3 here. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/ TR/html4/strict.dtd"> <html> <head> <title>Collapsible List — Take 1</title> <link rel="stylesheet" type="text/css" href="../common.css"> <script type="text/javascript" src="../scripts/jquery-1.2.1.js"></script> <script type="text/javascript"> $(function() { $('li:has(ul)') .click(function(event) { alert('in li'); }); $('fieldset') .mouseover(function(event) { alert('in fieldset'); }); }); </script> <style> fieldset { width: 320px } </style> </head> <body> <fieldset> <legend>Collapsible List — Take 1</legend> <ul> <li>Item 1</li> <li>Item 2</li> <li> Item 3 <ul> <li>Item 3.1</li> <li> Item 3.2 <ul> <li>Item 3.2.1</li> <li>Item 3.2.2</li> <li>Item 3.2.3</li> </ul> </li> <li>Item 3.3</li> </ul> </li> </ul> </fieldset> </body> </html> If I change the click event on the fieldset to mouseover, it still alerts both when i click on 3. But if change the child to mouseover and leave parent as click i only get the child one.