The situation is somewhat like-
var someVar = some_other_function(); someObj.addEventListener('click', function(){ some_function(someVar); }, false);
The problem is that the value of someVar is not visible inside the listener function of the addEventListener, where it is probably being treated as a new variable.
There is absolutely nothing wrong with the code you’ve written. Both
some_functionandsomeVarshould be accessible, in case they were available in the context where anonymouswas created.
Check if the alert gives you the value you’ve been looking for, be sure it will be accessible in the scope of anonymous function (unless you have more code that operates on the same
someVarvariable next to the call toaddEventListener)