jQuery 验证 - 不表单提交
Posted
技术标签:
【中文标题】jQuery 验证 - 不表单提交【英文标题】:jQuery validation-does not form submit 【发布时间】:2017-03-30 14:35:48 【问题描述】:我正在使用 jQuery 验证插件。它验证成功,但正确提交表单后未提交。
代码如下:
jQuery.validator.setDefaults(
debug: true,
success: "valid"
);
$("#myform").validate(
rules:
ip:
required: true,
maxlength: 15,
minlength: 11
,
assert_code:
required: true,
maxlength: 17,
minlength: 17
);
form example
<form id = "myform" method = "post" >
<input type = "text" name = "ip" id = "ip"/>
<input type = "text" name = "assert_cpde" id = "assert_code"/>
<input type = "submit" name = "submit" />
</form>
【问题讨论】:
正确提交表格后未提交请给我们代码? 【参考方案1】:assert_code
名称中有错字(你写了assert_cpde
)
正确版本:
<form id = "myform" method = "post" >
<input type = "text" name = "ip" id = "ip"/>
<input type = "text" name = "assert_code" id = "assert_code"/>
<input type = "submit" name = "submit" />
</form>
【讨论】:
【参考方案2】:我只需要编写这样的代码就完成了!
$(function()
$("#myform").validate(
rules:
ip:
required: true,
maxlength: 15,
minlength: 11
,
assert_code:
required: true,
maxlength: 17,
minlength: 17
);
);
【讨论】:
以上是关于jQuery 验证 - 不表单提交的主要内容,如果未能解决你的问题,请参考以下文章