The preventDefault() method stops the default action of a selected element from happening by a user. This method does not accept any parameter and works in two ways:
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function() { $("a").click(function(event) { event.preventDefault(); }); }); </script> </head> <body> <a href="https://www.tutorialspoint.com/">Tutorialspoint.com</a> <p>Click the link and it wont work.</p> </body> </html>