Answers for "how to close div when click outside its area"

0

Click Outside Close Menu Box

window.addEventListener('mouseup', function(event){
	var box = document.getElementById('box1');
	if (event.target != box && event.target.parentNode != box){
        box.style.display = 'none';
    }
});
Posted by: Guest on April-01-2020
0

how to detect click outside div

$(window).click(function() {
  //Hide the menus if visible
});

$('#menucontainer').click(function(event){
  event.stopPropagation();
});
Posted by: Guest on November-24-2021

Code answers related to "how to close div when click outside its area"

Browse Popular Code Answers by Language