jQuery hide element when clicked anywhere on the page
- by Franek
I would like to know if this is the correct way of hiding visible elements when clicked anywhere on the page.
$(document).click(function (event) {
$('#myDIV:visible').hide();
});
The element (div, span etc) cannot disappear when click event occurs withing the boundaries of the element.