Use jQuery to hide a DIV when the user clicks outside of it


$(document).mouseup(function (e)
var container = $("YOUR CONTAINER SELECTOR");

if (! // if the target of the click isn't the container...
&& container.has( === 0) // ... nor a descendant of the container

Leave a Reply

Your email address will not be published. Required fields are marked *