Skip to content

Instantly share code, notes, and snippets.

@ikai
Created July 17, 2009 20:56
Show Gist options
  • Save ikai/149273 to your computer and use it in GitHub Desktop.
Save ikai/149273 to your computer and use it in GitHub Desktop.
var anchors = document.getElementsByTagName("a");
for(var i = 0; i < anchors.length; i++) {
var a = anchors[i];
var href = a.getAttribute("href");
// for some reason the HREF in this onClick is always bound to the last element in anchors[]. WHY?!
a.onclick = function(el) {
//console.log(href);
return false;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment