if I have a field with a floating message and I wonder if clicking a paragraph text in this field will also register a click on its parent element in jQuery or if I have to add clicks for child elements.
update: here is the main layout:
<div id='msgbox'> <p>This is the <span>message</span></p> </div>
Now, if I press the text in <p>
or in <span>
, will it still start by pressing the $('#msgbox')
button?
update 2: Can I stop this behavior?
update 3: here is the fiddle I went with: http://jsfiddle.net/MZtbY/ - is there now a way to stop the spread after it reaches a certain level? so clicking <p>
would be ok, but pressing <span>
do nothing? - sort of like $('#msgbox :nth-child').click(function(e) {e.stopPropagation();});
source share