jQuery event.isDefaultPrevented()Method

jQuery 事件方法jQuery Event Methods

Example

Prevent the link from opening the URL, and check if preventDefault() was called:

$("a").click(function(event){
    event.preventDefault();
alert("Check whether preventDefault() is called: " + event.isDefaultPrevented());
});

Try it Yourself »

Definition and Usage

The event.isDefaultPrevented() method checks whether on the specified event was calledpreventDefault()method.


Syntax

event.isDefaultPrevented()

Parameters Description
event Required.eventThe parameter comes from the event binding function.


jQuery 事件方法jQuery Event Methods

Other Extensions