Check if clicked outside of element

$(document).mouseup(function (e){ // clickon web-document var div = $("#popup"); // set element ID if (!div.is(e.target) // if clicked not on current element && div.has(e.target).length === 0) { // and not on children div.hide(); // hide it } });

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.