gpt4 book ai didi

javascript - 未捕获的类型错误 : Cannot read property 'call' of undefined

转载 作者:可可西里 更新时间:2023-11-01 01:58:46 25 4
gpt4 key购买 nike

我有一个预先存在的表单,我正在尝试将 jquery 验证添加到包含:

<form id="form" method="POST" action="/title/">
{% csrf_token %}
<input type="hidden" name="id" value="6">
<input type="hidden" name="custom_checkbox_Electronic_Signature_man" value="1">
<p> <span class="style9">First Name </span>
<input type="text" name="first_name" value="" size="20" class="style7"><span class="style9">
Last Name </span>
<input type="text" name="last_name" value="" size="20" class="style7"><span class="style9">

使用 jquery 验证器插件,我添加了:

$('form').validate({
rules: {
first_name: {
minlen: 3,
maxlength: 15,
required: true
},
last_name: {
minlength: 3,
maxlength: 15,
required: true
},
email: {
required: true,
email: true
},
phone1: {
required: true,
phoneUS: true
},
phone2: {
required: true,
phoneUS: true
},
street: {
required: true
},
city: {
required: true
},
state: {
required: true
},
zip: {
zipcodeUS: true
}

},
highlight: function(element) {
$(element).closest('.style9').addClass('.style13');
//$(element).addClass('.style13');
},
unhighlight: function(element) {
$(element).closest('.style9').removeClass('.style13');
//$(element).removeClass('.style13');
},
errorElement: 'span',
errorClass: 'style13',
errorPlacement: function(error, element) {
if(element.parent('.input-group').length) {
error.insertAfter(element.parent());
} else {
error.insertAfter(element);
}
}
});

我收到上面列出的错误。我做错了什么?

最佳答案

minlen 替换为 minlength,它起作用了,没有 minlen 属性,所以 call 内部失败

$('form').validate({
rules: {
first_name: {
minlength: 3, // <- here
maxlength: 15,
required: true
},
last_name: {
minlength: 3,
maxlength: 15,
required: true
},
..........

关于javascript - 未捕获的类型错误 : Cannot read property 'call' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28410596/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com