Alternative for "return false;"

/ Published in: jQuery
Save to your folder(s)

Alternative for "return false;"
stopPropagation(); prevents for bubbling up the dom
preventDefault(); prevents the browser from performing the default action

Copy this code and paste it in your HTML
  1. function() {
  2. return false;
  3. }
  5. // is equal to
  7. function(e) {
  8. e.preventDefault();
  9. e.stopPropagation();
  10. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.