jquery isDefaultPrevented() method


  Translation results:

isDefaultPrevented

Prevent errors

jquery isDefaultPrevented() methodsyntax

Function: isDefaultPrevented() method returns whether the preventDefault() method is called on the specified event object.

Syntax: event.isDefaultPrevented()

Parameters:

ParameterDescription
event Required. Specifies the events that need to be checked. The event parameter comes from the event binding function.

jquery isDefaultPrevented() methodexample

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("a").click(function(event){
    event.preventDefault();
    alert("Default prevented: " + event.isDefaultPrevented());
  });
});
</script>
</head>
<body>
<a href="//m.sbmmt.com/">php中文网</a>
<p>preventDefault() 方法将防止上面的链接打开 URL。</p>
<p>请点击该链接,检查是否阻止了默认动作。</p>
</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance


##

Home

Videos

Q&A