javascript - ckeditor如何进行 jQuery Validate验证
大家讲道理
大家讲道理 2017-04-11 08:58:54
0
0
570

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>
    <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
    <script type="text/javascript" src="//cdn.ckeditor.com/4.4.7/standard/ckeditor.js"></script>

    <script>
        $().ready(function() {
            $("#commentForm").validate({
                  rules: {  
                              title:"required",
                            infro:{  
                                required:true,  
                                maxlength:150     
                            },
                             content:{  
                                required:true  
                             }   
                     },  
                  messages:{ 
                          title:"请输入标题",
                        infro:{  
                        required:"请输入简介.",  
                        maxlength:jQuery.format("简介必须在150字符以内.")   
                      },  
                        content:{  
                        required:"请填写内容." 
                     }  
                  }   
            });
        });
        
    </script>
</head>
<body>
     <form action=""  id="commentForm"  method="">
          
          <p class="list">
              <span> 标题:</span>
              <input type="text" name="title"  id="title" value="" maxlength="10">
          </p>
          <p class="list">
              <span> 简介:</span>
              <textarea class="ckeditor" id="infro"  maxlength="150" style="height:150px;" name='infro'></textarea>
          </p>
          <p class="list">
              <span> 内容:</span>
              <textarea class="ckeditor" id="content"   style="height:150px;" name='content'></textarea>
          </p>
          <p class="list">
              <span></span>
              <input type="submit" name="content" id="submit" value="提交" >
          </p>
    </form>
</body>

</html>

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template