I am using this code:
$(\'body\').click(function() { $(\'.form_wrapper\').hide(); }); $(\'.form_wrapper\').click(function(event){ event.stopPropagatio
var exclude_div = $("#ExcludedDiv");; $(document).click(function(e){ if( !exclude_div.is( e.target ) ) // if target div is not the one you want to exclude then add the class hidden $(".myDiv1").addClass("hidden"); });
FIDDLE