We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Ballyhoo


Posted By

fael on 09/09/07


Tagged

event window stopPropagation preventDefault


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

fael


Stop default action


Published in: JavaScript 


Really stop default action of a element.


  1. function stop(e) {
  2. if (!e) e = window.event;
  3. (e.stopPropagation) ? e.stopPropagation() : e.cancelBubble = true;
  4. (e.preventDefault) ? e.preventDefault() : e.returnValue = false;
  5. return false;
  6. }

Report this snippet 

You need to login to post a comment.