How is it possible to create a custom event handler and put some default variables in it??
scope A:
var a = 'weee';
var b = 'hmm';
var click = function(){
alert(a+' '+b);
}
scope B:
$('#btn').click = click;
When the button is clicked var a and b is undefined
Use
or
or
The problem when you do
is that instead of binding your function to the
"click"event, you’re replacing the jQueryclickfunction defined here by your own function.