Stopping Event Propagation
The diff b/w stopPropagation and stopImmediatePropagation
by Steven Senkus
HTML
<button id="btn0" type="button">CLICK with e.stopPropagation()</button><hr />
<button id="btn1" type="button">CLICK with e.stopImmediatePropagation()</button>
JavaScript
$('#btn0').on('click', function(e) {
e.stopPropagation();
alert(1);
});
$('#btn0').on('click', function(e) {
alert(2);
});
$('#btn1').on('click', function(e) {
e.stopImmediatePropagation();
alert(1);
});
$('#btn1').on('click', function(e) {
alert(2);
});