first post here. I was trying to make some tests using the if statement to fire an Alert, for example, when there's a lot of whatsApp buttons on website, but with differents specifications on it. So i tried to run this code:
window.addEventListener('click', function(event){
if(event.target.querySelector('a[href*="whatsapp.com"]')){
console.log('Hey WhatsApp!')
}
})
But this code isn't works, it does not return an error on Console, but it does not fires the console.log
You guys knows what is wrong with this code or if there's a way to validate on the if statement the querySelector of a clicked button?
Aucun commentaire:
Enregistrer un commentaire