How can I access util.log() method from a static html event handler?
In other words, when I click the checkbox, I like to call util.log method.
onclick="util.log(\'hey\')" <-- how to rewrite the event function here?
I know all the answers are correct down here but is it possible to access local methods while insert the html into innerHTML?
thank you
var utilities = function() {
var util = this;
util.log = function(msg){
alert(msg);
};
var p = document.createElement('p');
p.innerHTML = '<input type="checkbox" onclick="util.log(\'hey\')" value="1">Check me';
// this part has to be plain html, because there is this table generator class
// will insert this to cell as innerHTML. That's why I can't change the table class.
};