0

Detect a click outside an element.

Posted February 15th, 2010 in Javascript by freelancer

Attach a click event to the document body which closes the window. Attach a separate click event to the window which stops propagation to the document body.

$('body').click(function() {
 //Hide the menus if visible
 });

 $('#menucontainer').click(function(event){
     event.stopPropagation();
 });



Leave a Reply