You can do it:
$("#myElement").live('click', function(){
return false;
});
$("body").live('click', function(){
$("#myElement").hide();
});
How it works: if you click on an element, the click event will not bubble, causing a click on the element <body>. If you click outside the element, however, it bubbles up, eventually falling into <body>that which hides your element.
source
share