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:
(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.