I have a JavaScript that displays a DIV (sets its display css property from \'none\' to \'normal\'. Is there a way to give it focus as well so that when I click somewhere else o
On triggering mouseup() event, we can check the click is inside the div or a descendant and take action accordingly.
$(document).mouseup(function (e) { var divContent= $(".className"); if(!divContent.is(e.target) && divContent.has(e.target).length === 0) { $(".className").hide(); } });