1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>jQuery validation</title>
- <link rel="stylesheet" href="https://jqueryvalidation.org/files/demo/site-demos.css">
- </head>
- <body>
- <form id="myForm" method="get" action="http://www.bymyside.online">
- <label style="float:left;" for="email">Email:</label>
- <input type="email" style="float:left;" id="email" name="email1"><br>
- <label style="float:left;" for="name">Name:</label>
- <input type="text" style="float:left;" id="name" name="name"><br>
- <input type="submit" name="提交">
- </form>
- <script src="./lib/jquery.js"></script>
- <script src="./dist/jquery.validate.js"></script>
- <script src="./dist/additional-methods.js"></script>
- <script src="./src/localization/messages_zh.js"></script>
- <script>
- jQuery.validator.setDefaults({
- debug: true,
- success: "valid"
- });
- $( "#myForm" ).validate({
- rules: {
- // debug: true,
- // ignore: '#email',
- email: {
- required: true,
- email: true,
- remote: {
- url: "http://www.bymyside.online",
- type: "get",
- data: {
- username: function(){
- return 12;
- }
- }
- }
- },
- name: {
- required: true,
- step: 10
- }
- }
- });
- </script>
- </body>
- </html>
|