Home >>jQuery Tutorial >jQuery event.isDefaultPrevented() Method
jQuery event.isDefaultPrevented() method in jQuery is used to verify whether the preventDefault() method has been called for the event.
Syntax:event.isDefaultPrevented()
Parameter | Description |
---|---|
event | It is a required parameter and is used to the event parameter comes from the event binding function |
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".textlink").click(function(event){
event.preventDefault();
alert("preventDefault() called: " + event.isDefaultPrevented());
});
});
</script>
</head>
<body>
<a class="textlink" href="https://www.phptpoint.com/">Go to phptpoint.com</a>
</body>
</html>