+ -
当前位置:首页 → 问答吧 → 绑定带参函数,怎么把参数传过去!

绑定带参函数,怎么把参数传过去!

时间:2011-07-27

来源:互联网

我现在有一个function checkItemCode(code,indexId){}函数
我绑定事件$("#"+id).blur(checkItemCode)这个函数后 ,
怎么把参数传给function checkItemCode(code,indexId)这个函数

作者: wu_wenjie   发布时间: 2011-07-27

简单点就再套一层调用
JScript code

var anotherCheckItemCode = function (){
    //获取相关参数
    return checkItemCode(xxx,xxx);
};


作者: LiZnZ   发布时间: 2011-07-27

引用 1 楼 liznz 的回复:

简单点就再套一层调用
JScript code

var anotherCheckItemCode = function (){
//获取相关参数
return checkItemCode(xxx,xxx);
};

然后在绑定这个 anotherCheckItemCode函数给blur事件

作者: LiZnZ   发布时间: 2011-07-27

你绑定的id应该是已知的。
var id;
$("#"+id).blur(checkItemCode)
function checkItemCode(code){
var indexId=id
}

作者: jiergio   发布时间: 2011-07-27