Hello,
Could somebody help me with this? :
I have a button that when clicked it shows a certain div. This div has several descendants. Now, what I want is that when I click somewhere else in the document, but not in any of those descendants that this div disappears. what I thought was to use the not selector like this:
$("#button").click(function(){
$("#mydiv").show();
$(document.body).not($("#mydiv").children()).one('click',function(e) {
$("#mydiv").hide();
});
return false;
});
but this is not working! Any idea why? thanks