document.addEventListener("click", e => { if(e.target.matches(".clase")||e.target.matches(`${".clase"} *`)) { ... } }) /* Otro */ document.addEventListener("click", (e) => { if(e.target.classList.contains("desplegable") || e.target.parentElement.classList.contains("desplegable")) { document.querySelector(".filtros-desplegables").classList.toggle("is-active"); } })
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter