Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created May 22, 2016 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c2f2fabdde2ea14c71e4dd87ed1952f4 to your computer and use it in GitHub Desktop.
Save anonymous/c2f2fabdde2ea14c71e4dd87ed1952f4 to your computer and use it in GitHub Desktop.
function addLink(){
var liElements = document.getElementsByClassName("view")
var link = document.createElement ('a');
for (var i = 0; i < liElements.length; i++){
link.setAttribute('href',"#" + liElements[i].innerHTML);
liElements[i].appendChild(link);
console.log(liElements[i]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment