I would like to open email-signup when I click on email-signup-link. Then I would like to close it by clicking anywhere on the page except for the
email-signup
email-signup-link
var mouse_is_inside = false; $(document).ready(function() { $('.form_content').hover(function(){ mouse_is_inside=true; }, function(){ mouse_is_inside=false; }); $("body").mouseup(function(){ if(! mouse_is_inside) $('.form_wrapper').hide(); }); });
as referenced in another stackoverflow post...