Sample code:
function TestClass() {
this.init = function() {
this.updateHeader(); // <-- error line
};
this.updateHeader = function() {
console.log("Works");
};
};
var test = new TestClass();
$(document).ready(test.init);
When I run that in Firefox 3.5, Firebug gives me an error, saying that this.updateHeader is not a valid function. I'm a Java/PHP programmer and having some trouble understanding the Javascript OO-model. What am I doing wrong?
It does work if I replace the $(document).ready-line with simply test.init(), but I don't want that.