Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

click anywhere and div hide javascript

document.addEventListener('mouseup', function(e) {
  let container = document.getElementById('container');
  if (!container.contains(e.target)) {
    container.style.display = 'none';
  }
});
 
PREVIOUS NEXT
Tagged: #click #div #hide #javascript
ADD COMMENT
Topic
Name
6+9 =