问答详情
源自:1-2 如何开始及举例

为什么这里的中文提示不起作用?出来的还是英文提示。跪求大神指教!

<body>
  <form id="leform">
    <fieldset>
      <legend>用户登录</legend>
      <p>
        <label for="iusername">用户名</label>
        <input type="text" name="nusername" id="iusername">
      </p>
      <p>
        <label for="ipassword">密码</label>
        <input type="password" name="npassword" id="ipassword">
      </p>
      <p>
        <label for="icomfirm-password">确认密码</label>
        <input type="password" name="nconfirm-password" id="icomfirm-password">
      </p>
      <p>
        <input type="submit" value="登录">
      </p>
    </fieldset>
  </form>  

<script src="vendor/jquery-1.10.0.js"></script>
<script src="vendor/jquery.validate-1.13.1.js"></script>  
  <script>
    $(document).ready(function(){
      $("#leform").validate({
        rules:{
          nusername:{
            required:true,//必填
            minlength:2,
            maxlength:10
          },
          npassword:{
            required:true,//必填
            minlength:2,
            maxlength:16
          },
          "nconfirm-password": {
            equalTo: "#ipassword"
          },
          messages:{
            nusername:{
              required: "请输入用户名",
              maxlength: "用户名不能超过10个字符",
              minlength: "用户名不能小于2个字符"
            },
            npassword:{
              required: '请输入密码',
              minlength: '密码不能小于2个字符',
              maxlength: '密码不能超过16个字符'
            },
            "nconfirm-password":{
              equalTo: "两次输入密码不一致"
            },
          },
        },
      });
    });
  </script>
</body>

提问者:慕桂英6986110 2017-08-01 20:25

个回答

  • qq_不二柚子_0
    2017-08-02 11:24:40

     required: "请输入用户名",

    required:"请输入用户名",

    你的冒号或者双引号有一个是中文格式吧