I\'m trying to hide a div if the user clicks anywhere BUT the popup OR its children. This is the code I have so far:
$(\"body\").click(function(){ var $t
Do this:
$(document).click(function (e) { // show_alerts is the class of the link to display the popup if (!$(e.target).parents().andSelf().is('.show_alerts')) { // hide your popup } });
example: http://jsfiddle.net/Acf3F/