I wish to access a variable named storedata while dynamically changing the objects event onclick event handler
function update_data(storedata)
{
obj.onclick=function() {remover(this,storedata); };
}
Not able to access storedata within the inner function.
When I try using alert(obj.onclick) the result comes out to be remover(this,storedata). It seems the variable is not been replaced by its value!!
Any Ideas?
It is “replaced”. The problem is just the way you are trying to inspect it.
When you alert a function, you get a stringified version of the function … and that includes the variable names and not serialisations of every variable.
If you were to actually call the function, the variable would be available with the value you gave it.