var input = document.createElement(“input”);
input.onclick = someFunction; // not someFunction(); or “someFunction()”;
- OR -
input.onclick = function() { };
It must be a pointer to the function, not a function call or string. Also note that the event is named “onclick”, not “onClick”.
Advertisement