I'm using event.stopPropagation()
in my application. There has appeared, however, one scenario where I want the propagation to continue as if the aforementioned function was never called. So I'm wondering; is there a way to "resume" propagation after it's been stopped? It would be terribly tedious to move the one call to event.stopPropagation
to a dozen separate conditional statements.
The event. stopPropagation() method stops the bubbling of an event to parent elements, preventing any parent event handlers from being executed. Tip: Use the event. isPropagationStopped() method to check whether this method was called for the event.
submit(function(event) { event. preventDefault(); return false; }); } }); function validateField() { var first_name = $('#first_name').
If you want to stop the event bubbling, this can be achieved by the use of the event. stopPropagation() method. If you want to stop the event flow from event target to top element in DOM, event. stopPropagation() method stops the event to travel to the bottom to top.
Once propagation has been stopped, it cannot be resumed. As a workaround, what you can do is set a variable, and then only stop if this variable is true:
var stop = false;
// do your logic here
if(stop){
event.stopPropagation();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With