Tuesday, 20 August 2013

How do you hide a div by clicking anywhere outside that div?

How do you hide a div by clicking anywhere outside that div?

I'm displaying an iframe overlay with a z-index of 9999 with 100% width
and height. The actual div inside the iframe is is only 620px wide. The
problem is, I can not hide the iframe by simply click outside that div.
Here's the code I'm using now
$(document).click(function() {
alert("hide iframe");
});
$(".myDivInsideMyIframe").click(function(e) {
e.stopPropagation();
return false;
});
How can I hide my iframe by click outside the div thats inside?

No comments:

Post a Comment