Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

stopimmediatepropagation vs stoppropagation

<!---- stopImmediatePropagation() vs stopPropagation() ----------------->

`stopPropagation` allows other event handlers on the SAME ELEMENT 
on the SAME EVENT to be executed, while `stopImmediatePropagation`
prevents this.

<script>
el.addEventListener( "click", e => e.stopImmediatePropagation() )
el.addEventListener( "click", e => console.log("This will not run.") )
</script>

<!----------------- stopImmediatePropagation() vs stopPropagation() ---->
 
PREVIOUS NEXT
Tagged: #stopimmediatepropagation #stoppropagation
ADD COMMENT
Topic
Name
7+3 =