How to use preventDefault() Method in jQuery

This article describe about jQuery Event preventDefault() Method.
  • 2590

jQuery Event preventDefault() Method

For prevent of the default action of an element from happening (for example, preventing from submitted when a submit button is clicked) use the preventDefault() method.




Parameter Description
Event Required. It define the event to use. The event parameter comes from event bind method


<!DOCTYPE html>



<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {

        $("a").click(function (event) {







<a href="/">Go to </a>

<p>The preventDefault() method will prevent the link above from the URL.</p>






preventDefault method pic20.jpg

Note: In the output URL mention, but prevent from from click.

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2020 DotNetHeaven. All rights reserved.