Home > Web Front-end > JS Tutorial > jquery event preventDefault() method usage example_jquery

jquery event preventDefault() method usage example_jquery

WBOY
Release: 2016-05-16 16:20:00
Original
1337 people have browsed it

The example in this article describes the usage of the jquery event preventDefault() method. Share it with everyone for your reference. The specific implementation method is as follows:

Copy code The code is as follows:


jquery event: use of preventDefault() method









Additional instructions:

(1) If you want to obtain event-related information, add a parameter to the anonymous function. e in the example represents the object of the event.
(2) By calling the preventDefault() method of the event object, the default behavior can be prevented from occurring (such as sending to http://www.baidu.com in the example).

In addition, calling the stopPropagation() method of the event object can prevent the occurrence of bubbling events. Regarding the bubbling model and capturing model, please refer to another article "Instance analysis of event capturing model and bubbling model in js".

I hope this article will be helpful to everyone’s jQuery programming.

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