If you want to clear the div when you click somewhere else in the page, you can do something like:
$('body').click(function(event) {
if (!$(event.target).closest('#myDiv').length) {
$('#myDiv').hide();
};
});
If you want to clear the div when you click somewhere else in the page, you can do something like:
$('body').click(function(event) {
if (!$(event.target).closest('#myDiv').length) {
$('#myDiv').hide();
};
});