jquery preventDefault () method syntax

jquery preventDefault () method syntax

Role: preventDefault () method to prevent the default behavior of elements occurs (for example, prevent submission of the form when you click on the submit button). Marble platform price

Syntax: event.preventDefault ()

parameter:

parameter description
event     essential. The default action which event the provisions blocked. The event parameters from the event binding function.

jquery preventDefault () method of Example

<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();
  });
});
</script>
</head>
<body>
<a href="http://www.furuihua.cn/"> marble platform </a>
<P> preventDefault () method will prevent the opening of the link above URL. </ P>
</body>
</html>

Guess you like

Origin www.cnblogs.com/furuihua/p/11962503.html