Guest User

Untitled

a guest
Jun 17th, 2012
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. What's the difference between event.stopPropagation and event.preventDefault?
  2. <div id="foo">
  3. <button id="but" />
  4. </div>
  5.  
  6. $("#foo").click(function() {
  7. // mouse click on div
  8. });
  9.  
  10. $("#but").click(function(ev) {
  11. // mouse click on button
  12. ev.stopPropagation();
  13. });
Advertisement
Add Comment
Please, Sign In to add comment