zoukankan      html  css  js  c++  java
  • jquery validate验证方法

    实例:

    equalTo方法

     equalTo(其他)返回:布尔

    说明:要求元素与另一个元素相同

    例子:

    使“字段”必须与#other相同

    1
    2
    3
    4
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    三十
    31
    32
    33
    34
    35
    36
    37
    38
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Makes "field" required to be the same as #other</title>
    <link rel="stylesheet" href="https://jqueryvalidation.org/files/demo/site-demos.css">
     
    </head>
    <body>
    <form id="myform">
    <label for="password">Password</label>
    <input id="password" name="password" />
    <br/>
    <label for="password_again">Again</label>
    <input class="left" id="password_again" name="password_again" />
    <br>
    <input type="submit" value="Validate!">
    </form>
    <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
    <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
    <script>
    // just for the demos, avoids form submit
    jQuery.validator.setDefaults({
    debug: true,
    success: "valid"
    });
    $( "#myform" ).validate({
    rules: {
    password: "required",
    password_again: {
    equalTo: "#password"
    }
    }
    });
    </script>
    </body>
    </html>
  • 相关阅读:
    C语言 · 阶乘计算 · 基础练习
    C语言 · 查找整数 · 基础练习
    UML课程复习重点
    运维参考
    mysql语法总结
    Python杂篇
    Python练习题
    Python参考
    k8s中ipvs和iptables选择
    安装cni网络插件-非必须
  • 原文地址:https://www.cnblogs.com/mr-wuxiansheng/p/8046127.html
Copyright © 2011-2022 走看看