I took the following code from a question here on StackOverflow:
$('body').click(function(event) {
if (!$(event.target).closest('#myDiv').length) {
$('#myDiv').hide();
};
});
The only problem is that on Firefox (on Safari works) doesn't work. Why is that? How should I change it to make it compatible with Firefox?