Vanilla JavaScript version of jQuery .click
Working Example: http://jsfiddle.net/6ZNws/ Html <a href=”https://stackoverflow.com/questions/7556564/something”>CLick Here</a> <a href=”https://stackoverflow.com/questions/7556564/something”>CLick Here</a> <a href=”https://stackoverflow.com/questions/7556564/something”>CLick Here</a> Javascript: var anchors = document.getElementsByTagName(‘a’); for(var z = 0; z < anchors.length; z++) { var elem = anchors[z]; elem.onclick = function() { alert(“hello”); return false; }; }