24 ways to impress your friends

Jump to menu

Vote down?


Alex: document.getElementById(‘clickme’).onclick = function();

Is the way to add events for clicking. You could also loop through all the anchors on the page, or within a section and hi-jack the link, and use the onclick event.

element.style.className = ‘className’; is the simplist way of adding a class name. However, because there are multiple classes this may not be the most ideal solution. I recommend using the ‘addClass’ function