Skip to content

Instantly share code, notes, and snippets.

@llagerlof
Created July 24, 2018 14:25
Show Gist options
  • Save llagerlof/9546c0afdf1bb4a0823115065cdcd9ae to your computer and use it in GitHub Desktop.
Save llagerlof/9546c0afdf1bb4a0823115065cdcd9ae to your computer and use it in GitHub Desktop.
Console javascript loop through elements, add class and set attribute value (on line)
var nodes = document.querySelectorAll("h1[style='margin:0px;']"); for(i=0; i<nodes.length; i++) { nodes[i].classList.add("opened"); nodes[i].setAttribute("aria-expanded", "true"); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment