Jquery Snippet to hide some div by clicking outside

If we want apply something to hide by clicking outside the div or another div, use the following jquery code to do that.

which will be quite usefull often.

$(document).click(function(){
$("#div1").hide();
});

$("#div2,#div3").click(function(e){
e.stopPropagation();
});

in this example i use first div to hide, then i use div areas to leave the click.

Post a Comment

Post a Comment (0)

Previous Post Next Post