I have the following function
function hello() {
alert(\"hi!\");
}
Take this piece of code:
var elem = document.getElem
A reference to your function is needed somewhere no matter how it gets called. The difference here is that you are not explicitly calling the hello
function. You are assigning a reference to that function to the elem
DOM node's onclick
event handler so that when onclick
is fired for that Node, your function gets called.