【发布时间】:2014-05-11 17:44:18
【问题描述】:
如何使用 jQuery 验证插件获取对提交按钮的引用?
function defSubmHendler(){
$myform.validate({
rules: rules,
messages: messages,
submitHandler: function() {
event.preventDefault();
if (~this form id == A){
condition1;
}
else if (~this form id == B){
condition2;
} else {}
...
$.ajax({
...
});
}
});
}
在这种情况下 this == $.validator。我需要在 submitHandler 中引用提交按钮/表单。
【问题讨论】:
-
你怎么打电话给
defSubmitHandler? -
动态创建表单,然后执行 defSubmHendler('destination_form')
标签: javascript jquery validation