Created
July 27, 2015 04:55
-
-
Save deadlyhifi/d6700b1751d628018552 to your computer and use it in GitHub Desktop.
Get element by class and add a class
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
var matches = document.querySelector("div.js-nav"); | |
for (var i = 0; i < matches.classList.length; i++) { | |
matches.classList.add('TEST'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment