Skip to content

Instantly share code, notes, and snippets.

@thisgeek
Created May 12, 2010 20:24
Show Gist options
  • Save thisgeek/399081 to your computer and use it in GitHub Desktop.
Save thisgeek/399081 to your computer and use it in GitHub Desktop.
jQuery.fn.hideOnClickOutside = function () {
target = jQuery(this);
jQuery(document).one('click', function() {
target.hide();
});
target.click( function(event) {
event.stopPropagation();
});
return target;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment