click anywhere and div hide javascript code example
Example: 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';
}
});