The stopImmediatePropagation JS Event invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects.
event.stopImmediatePropagation()
<!doctype html>
<html>
<body>
<div>
<p>
<button>button</button>
</p>
</div>
<output></output>
<script>
function myfunction1(myparameter)
{
myoutput.innerHTML = myparameter.currentTarget;
}
function myfunction2(myparameter)
{
myparameter.stopImmediatePropagation();
myoutput.innerHTML += myparameter.currentTarget;
}
function myfunction3(myparameter)
{
myoutput.innerHTML += myparameter.currentTarget;
}
const myoutput = document.querySelector("output");
document.querySelector("button").addEventListener("mouseover", myfunction1);
document.querySelector("p").addEventListener("mouseover", myfunction2);
document.querySelector("div").addEventListener("mouseover", myfunction3);
</script>
</body>
</html>