So maybe I\'m just not looking in the right places but I can\'t find a good explanation of how to do the equivalent of jQuery\'s
$(\'a\').click(function(){
This will assign an onclick function to every a element.
onclick
a
var links = document.getElementsByTagName("a"); var linkClick = function() { //code here }; for(var i = 0; i < links.length; i++){ links[i].onclick = linkClick; }
You can see it in action here.