Solved, Yohoo
I have a dialog plugin, like this
$("#dialog").dialog({
click:function(){
alert(1);
},
'class':"dialog"
});
Following code is a chunk of main code that loop on options and check if key is a jQuery function and then call it else set it as attribute
$.each(options,function(key,val){
if(key in $.attrFn){
$('#div')[key](val); // I want pass arguments to this function
// equal $('#div').click(function(args){
// alert(1);
// });
// this is like jQuery ui dialog buttons options
} else {
$('#div').attr(key,val);
}
});
I want pass some arguments to the function, but I don't know how??
Example:
$("#dialog").dialog({
click:function(dialog){
dialog.disAppear();
},
'class':"dialog"
});
Solved:
$.each(v,function(q,w){
if(q in $.attrFn){
//console.log(dialog);
b[q](function(){
w(dialog);
});
} else {
b.attr(q,w);
}
});