Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery表单验证-弹出特定复选框_Jquery_Validation - Fatal编程技术网

Jquery表单验证-弹出特定复选框

Jquery表单验证-弹出特定复选框,jquery,validation,Jquery,Validation,我使用Jquery表单验证。在访客提交之前,我需要勾选“条款和条件”复选框。如果未选中,我希望在警报框中看到消息。(文本框附近显示的其他消息) 如何设置?我试试这个: $("#myform").validate({ errorPlacement: function(error, element) { if ( element.is(":checkbox") ) { alert(error.html());

我使用Jquery表单验证。在访客提交之前,我需要勾选“条款和条件”复选框。如果未选中,我希望在警报框中看到消息。(文本框附近显示的其他消息)

如何设置?我试试这个:

 $("#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”){