Skip to content

Instantly share code, notes, and snippets.

@deadlyhifi
Created July 27, 2015 04:55
Show Gist options
  • Save deadlyhifi/d6700b1751d628018552 to your computer and use it in GitHub Desktop.
Save deadlyhifi/d6700b1751d628018552 to your computer and use it in GitHub Desktop.
Get element by class and add a class
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