大佬教程收集整理的这篇文章主要介绍了使用jQuery验证验证多个复选框,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
编辑:我为我的输入名称=列表参数(列表[])添加了括号.同样在我的规则中,我将名称参数从列表更改为’list []’.我的旧代码如下.谢谢Sparky!
OLD: <input type='checkBox' name='list' id='fullProduct'></input> FIXED: <input type='checkBox' name='list[]' id='fullProduct'></input>
这是我的代码.
$("#TradeForm").validate({ rules: { startDate: { required: true,date: true },endDate: { required: true,showName: { required: true,minlength: 5 },LOCATIOn: { required: true },list: { required: true } },messages: { startDate: "*",endDate: "*" } }); <table> <tr> <th>Name of Show</th> <td> <input type='text' name='showName'></input></td> </tr> <tr> <th>LOCATIOn</th> <td><input type='text' name='LOCATIOn'></input></td> </tr> <tr> <th><span style='padding-right: 50px;'>SELEct Literature</span></th> <td><input type='checkBox' name='list' id='fullProduct'></input><span style='font-size: 12px;'>Guide One</span></td> <td><input type='checkBox' name='list' id='oilProduct'></input><span style='font-size: 12px;'>Guide Two</span></td> </tr> <tr> <td></td> <td><input type='checkBox' name='list' id='diamondProduct'></input><span style='font-size: 12px;'>Guide Three</span></td> <td><input type='checkBox' name='list' id='motorProduct'></input><span style='font-size: 12px;'>Guide Four</span></td> </tr> </table>
[]
,you must enclose it in quotes:
rules: { 'list[]': { required: true } },
以上是大佬教程为你收集整理的使用jQuery验证验证多个复选框全部内容,希望文章能够帮你解决使用jQuery验证验证多个复选框所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。