Jquery表单验证-弹出特定复选框
我使用Jquery表单验证。在访客提交之前,我需要勾选“条款和条件”复选框。如果未选中,我希望在警报框中看到消息。(文本框附近显示的其他消息) 如何设置?我试试这个:Jquery表单验证-弹出特定复选框,jquery,validation,Jquery,Validation,我使用Jquery表单验证。在访客提交之前,我需要勾选“条款和条件”复选框。如果未选中,我希望在警报框中看到消息。(文本框附近显示的其他消息) 如何设置?我试试这个: $("#myform").validate({ errorPlacement: function(error, element) { if ( element.is(":checkbox") ) { alert(error.html());
$("#myform").validate({
errorPlacement: function(error, element) {
if ( element.is(":checkbox") ) {
alert(error.html());
}
},
rules: {
name: {
required: true,
minlength: 3,
maxlength: 40,
lettersonly: false
},
ad: {
.....
但这并不奏效
谢谢您的帮助。
错误
没有html()函数。您可能试图提醒元素的标记
alert(element.html());
错误
没有html()函数。您可能试图提醒元素的标记
alert(element.html());
在第3行中,它应该是:
如果第3行中(element.is(“:checked”){
,则应为:
if(element.is(“:checked”){