Wednesday, 14 September 2022

Event prevent default vs event. stopprogpgation vs event.stopimmidatepropgation

 https://stackoverflow.com/questions/5299740/stoppropagation-vs-stopimmediatepropagation


  • e.stopImmediatePropagation() stops any further handler from being called for this event, no exceptions
  • e.stopPropagation() is similar, but does still call all handlers for this phase on this element if not called already


https://www.w3schools.com/jquery/event_preventdefault.asp

The event.preventDefault() method stops the default action of an element from happening.

For example:

  • Prevent a submit button from submitting a form
  • Prevent a link from following the URL

No comments:

Post a Comment