How To Prevent Default Event Behavior Using jQuery
erics, Posted May 23rd, 2011 at 10:39:46pm
1 2 3 4 |
jQuery("a").click(function(event) { event.preventDefault(); ...your code here... }); |
Quote from original post:
“e.preventDefault() will prevent the default event from occuring, e.stopPropagation() will prevent the event from bubbling up and return false will do both. Note that this behaviour differs from normal (non-jQuery) event handlers, in which, notably, return false does not stop the event from bubbling up.”
Original Post:
http://stackoverflow.com/questions/1357118/javascript-event-preventdefault-vs-return-false
Other Event Resources:
http://api.jquery.com/event.preventDefault/
http://api.jquery.com/category/events/event-object/
Leave Your Comment
All fields marked with "*" are required.