Posted By

denisediniz on 07/16/13


Tagged

element click bind


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Priestd09


jQuery bind click *ANYTHING* but *ELEMENT*


 / Published in: jQuery
 

URL: http://stackoverflow.com/questions/6635659/jquery-bind-click-anything-but-element

jQuery bind click ANYTHING but ELEMENT

  1. $('div#special').bind('click', function(){
  2. e.stopPropagation(); //prevents event
  3. });
  4.  
  5. $(document).bind('click', function(e) {
  6. if(!$(e.target).is('#special')) {
  7. // do something
  8. }
  9. });

Report this snippet  

You need to login to post a comment.