Im trying to make a popup div (when a text-box value changes) and it can be closed (visibility: none) by clicking anywhere outside the div. Similar to Google suggestion drop-dow
The jquery solution would be
$("body > div").click(function() {
if ($(this).attr("id") == "div-id") {
// inside the DIV
} else {
// not inside the DIV
}
});
or
$("html").click(function (e)
{
if (e.target == document.getElementById("div-id"))
alert("Inside DIV");
else
alert("Outside DIV!");
});
or Javascript snippet would be something like this: