jquery validate验证方法
生活随笔
收集整理的這篇文章主要介紹了
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> |
?
總結
以上是生活随笔為你收集整理的jquery validate验证方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 大数据学习(1)Hadoop安装
- 下一篇: win8--PPTP教程