Skip to content

Instantly share code, notes, and snippets.

@taybenlor
Created May 30, 2012 01:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taybenlor/2832029 to your computer and use it in GitHub Desktop.
Save taybenlor/2832029 to your computer and use it in GitHub Desktop.
var handler = function(event){
// if the target is a descendent of container do nothing
if($(event.target).is(".container, .container *")) return;
// remove event handler from document
$(document).off("click", handler);
// dostuff
}
$(document).on("click", handler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment