Posted By

lamebollock on 11/15/10


Tagged

event default jquery prevent


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

jillella


Prevent default event action


 / Published in: jQuery
 

URL: http://api.jquery.com/event.preventDefault/

Description: If this method is called, the default action of the event will not be triggered.

For example, clicked anchors will not take the browser to a new URL. We can use event.isDefaultPrevented() to determine if this method has been called by an event handler that was triggered by this event.

  1. $("a").click(function(event) {
  2. event.preventDefault();
  3. //CODE
  4. });

Report this snippet  

You need to login to post a comment.