Skip to content

Instantly share code, notes, and snippets.

@nola
Created November 26, 2013 01:12
Show Gist options
  • Select an option

  • Save nola/7651848 to your computer and use it in GitHub Desktop.

Select an option

Save nola/7651848 to your computer and use it in GitHub Desktop.
javascript for loop
var myLinkCollection = document.getElementsByTagName("a");
for (i=0;i<myLinkCollection.length;i++) {
if (myLinkCollection[i].getAttribute("href")) {
// do something with the anchor tags here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment