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
One method would be to popup a div behind that covers the whole screen (invisible), and capture clicks on that div to close both popup divs. You could also try capturing clicks on the body
tag and that should catch clicks anywhere outside the div (or inside the div as well if events bubble - you may want to perform some testing).
Sometimes an easier method is to use a timeout, like popup CSS menus that disappear once your mouse has been off of the menu for a couple of seconds. You can catch the onmouseleave
event, start a timer, and as long as there isn't another onmouseenter
in say, two seconds, then hide the popup div.
Hope this helps!