jQuery hide element when clicked anywhere on the page

Posted by Franek on Stack Overflow See other posts from Stack Overflow or by Franek
Published on 2009-04-03T15:31:28Z Indexed on 2010/04/21 11:13 UTC
Read the original article Hit count: 204

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about events