myDiv: with clickable items inside myList
myList with its clickable list items:
- myItem1: See the onclick propagate from the li to the list to the div
- myItem1A: Same as myItem1; just showing the propagation from another li
- myItem2: For this item we stopped the propagation
- myItem3: This time we use an onclick handler which is passed the event, but still bubbles up
- myItem4: Same as myItem3; just showing the propagation from another li
yourDiv with some clickable items inside yourList:
The first two items and the div have onclick handlers, third item and the list do not.
Notice that the bubbling goes from the list item directly to the div.
Also notice that as the click on yourItem2 propagates, the value of this is the currentTarget.
- yourItem1 has an onclick handler
- yourItem2 also has an onclick handler
- yourItem3: Has no onclick, but watch clicks bubble up.