-
-
Save handleman/3e81400f21bc24ccd370 to your computer and use it in GitHub Desktop.
hide element when user clicks outside the 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
$.fn.hideOnClickOutside = function () { | |
target = $(this); | |
$(document).on('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