最新回答 / xlhy_
没引入validatejs代码中的rules里的属性名要对应表单项里的name,例如你上面的用户名输入框代码可以改成:<input type="text" id="username" name="username">,其中name='username'对应rules:{username:...}
2016-10-24
<script>{$("form").validate({rules:{username:{required:true,minlength:2,maxlength:10},password:{required:true,minlength:2,maxlength:16}},message:{username:{required:"用户名必填", minlength:"长度至少两位",maxlength:"长度最多十位"},password:{required:"密码必填",minlength:"长度最少两位",maxlength:"长度最多十六位"}}});}</script>
2016-10-16