DEV Community

Discussion on: Creating A Custom, Accessible Drop Down

Collapse
 
kevsingh98 profile image
kevsingh98 • Edited
function _clickOutside() {
   document.addEventListener("click", function (event) {
     if (event.target.closest(".dropdown")) { //replace the class name to your needs
     return;
     }
     close(); //just calling a function that removes classList of isOpen
     }, false);
}

Hope this can help :)