Created
February 21, 2018 19:35
-
-
Save davidchc/5f0fca8887afa9ec1837ec7b5b94851e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Pega todos os elementos q estão com .items | |
let links = document.querySelectorAll('.items'); | |
//Pecorre esse elemento | |
links.forEach(link => { | |
//Atribui ação a esse elemento | |
link.addEventListener('click', e => { | |
e.preventDefault(); | |
//pega todos os nomes da classe desse elemento | |
let names = link.className.split(' '); | |
//verifica se o nome estados está no array | |
if(names.indexOf('estados')) { | |
//Executa ação | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment