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
You can bind a function on click of body and check if its the current div using e.target (e is the event)
$(document).ready(function () { $("body").click(function(e) { if($(e.target).attr('id') === "div-id") { $("#div-id").show(); } else { $("#div-id").hide(); } }); });