I quite often have to bind? some function that requires arguments. The solution I use is wrapping the function to bind inside an anonymous function.
function foo( arg_0 ) {
// do stuff with: arg_0
}
function bar() {
var abc;
// stuff happens
abc = 'some value';
attachEventHandler(elementId, 'click', function(){foo( abc );});
}
bar();
Is there a more elegant way of doing this?