Home > Web Front-end > JS Tutorial > body text

Blocking and allowing jquery's bubbling events (three implementation methods)_jquery

WBOY
Release: 2016-05-16 17:42:27
Original
1264 people have browsed it

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!