Created
July 21, 2015 06:17
-
-
Save TemporaryJam/2f9589dd83abe9cd5e64 to your computer and use it in GitHub Desktop.
Detect a click outside of an element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).click(function(event) { | |
if(!$(event.target).closest('#id-of-thing-youre-detecting-the-click-outside-of').length) { | |
//close something or do something | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment