Example

Prevent a link from opening the URL, and alert the result from isDefaultPrevented():

$("a").click(function(event){
   event.preventDefault();
  alert("Default prevented: " + event.isDefaultPrevented());
});

Try it yourself »

Definition and Usage

The isDefaultPrevented() method returns whether or not the preventDefault() method is called for the specified event object.

Syntax

event.isDefaultPrevented()

Parameter Description
event Required. Specifies the event to check. The event parameter comes from the event binding function