Home > Article > Web Front-end > Blocking and allowing jquery's bubbling events (three implementation methods)_jquery
Sometimes we don't want bubbling or default events to occur, so we need some jQuery methods to prevent bubbling and default events.
Different levels of blocking can be achieved through the following three methods.
A: return false --->In event handler, prevents default behavior and event bubbling.
return false In event processing, you can prevent default events and bubbling events.
B: event.preventDefault()---> In event handler, prevent default event (allows bubbling).
event.preventDefault() can prevent default events but allow bubbling events to occur during event processing.
C: event.stopPropagation()---> In event handler, prevent bubbling (allows default behavior).
event.stopPropagation() in event processing, can prevent bubbling but allow default behavior the occurrence of events.