I understand(at least in theory) what event bubbling is in javascript. I see examples and tutorial on line. What I fail to see is, if we always put stop propagation to stop event from bubbling when there are matches, why do we need event bubbling in the first place?
Am I correct in assuming that this is so because event bubbling starts at inner most and not inner most matching?
I am just not happy with any explanation(or perhaps I am not reading what I should be reading?)
My question is very simple.
Given below code
<style>
body * {
margin: 10px;
border: 1px solid blue;
}
</style>
<form onclick="alert('form')">FORM
<div onclick="alert('div')">DIV
<p onclick="alert('p')">P</p>
</div>
</form>
How is bubbling up useful if all I want was when div was clicked, do alert('div') ? In what case, do I want this thing to bubble up and also do alert 'form' when div was clicked??