Quick question about JSON in general, say I had:
var foo = {
a: null,
init: function() {
this.a = document.getElementById(...);
}
}
This will give have a with null. Is there anyway to go outside this scope and get the document element other than doing it externally via foo.a = document.getElementById(...)?
EDIT: Changed title more appropriately.
I am calling foo.init(), but when I do this, say I have:
and then I call init.foo() which contains this.a = document.getElementById('test') it seems to return NULL, perhaps I am doing something wrong.