Javascript examples for DOM Event:preventDefault
return false vs preventDefault()
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.4.2.js"></script> <script type="text/javascript"> $(window).load(function(){// w w w . j av a2 s . co m $("a").click(function(e) { e.preventDefault(); }); $("div").click(function() { $(this).css("border", "1px solid red"); }); }); </script> </head> <body> <div> Here is some text <a href="www.google.com">Click!</a> </div> </body> </html>