Created
September 17, 2019 19:25
-
-
Save evaldobarbosa/f525f42f6e05365a821e162855dd3df6 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
window.addEventListener('load', function() { | |
document.querySelectorAll('.btn-group .btn') | |
.forEach(item => { | |
item.addEventListener('click', function(e) { | |
e.target.parentNode.childNodes.forEach(function(node) { | |
if (node.firstChild !== null) { | |
node.firstChild.removeAttribute('checked') | |
} | |
if (node.classList !== undefined) { | |
node.classList.remove('active') | |
} | |
}) | |
e.target.classList.add('active') | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment