Answers for "find a div and click inside a element inside div"

2

check if click is inside div javascript

var container = document.getElementsByClassName('container')[0];
document.addEventListener('click', function( event ) {
  if (container !== event.target && !container.contains(event.target)) {    
    console.log('clicking outside the div');
  }
});
Posted by: Guest on November-13-2020

Code answers related to "find a div and click inside a element inside div"

Code answers related to "Javascript"

Browse Popular Code Answers by Language