【发布时间】:2012-06-12 03:56:52
【问题描述】:
我对如何使用 jQuery.validate 插件访问提交的表单感到困惑。
在API选项的“成功”选项中:http://jquery.malsup.com/form/#options-object
它说成功函数中的第 4 个参数是 jquery 包装的表单对象,但我尝试使用 jQuery 访问它时一直说是 undefined。
这是成功函数在他们的示例页面上的外观:http://jquery.malsup.com/form/#ajaxSubmit
function showResponse(responseText, statusText, xhr, $form) {
var id=$form.attr('id');
console.log('id:'+id);
}
不幸的是,console.log 显示Uncaught TypeError: Cannot call method 'attr' of undefined.
有什么想法吗?
谢谢, 时间
【问题讨论】:
-
我认为您使用的是 jQuery () 中有一些注释,请参阅
-
@thecodeparadox,谢谢我使用 jQuery1.7.1。我看到了那张纸条,但不知道我是否误解了什么。
标签: javascript jquery jquery-validate