index.html 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>jQuery validation</title>
  6. <link rel="stylesheet" href="https://jqueryvalidation.org/files/demo/site-demos.css">
  7. </head>
  8. <body>
  9. <form id="myForm" method="get" action="http://www.bymyside.online">
  10. <label style="float:left;" for="email">Email:</label>
  11. <input type="email" style="float:left;" id="email" name="email1"><br>
  12. <label style="float:left;" for="name">Name:</label>
  13. <input type="text" style="float:left;" id="name" name="name"><br>
  14. <input type="submit" name="提交">
  15. </form>
  16. <script src="./lib/jquery.js"></script>
  17. <script src="./dist/jquery.validate.js"></script>
  18. <script src="./dist/additional-methods.js"></script>
  19. <script src="./src/localization/messages_zh.js"></script>
  20. <script>
  21. jQuery.validator.setDefaults({
  22. debug: true,
  23. success: "valid"
  24. });
  25. $( "#myForm" ).validate({
  26. rules: {
  27. // debug: true,
  28. // ignore: '#email',
  29. email: {
  30. required: true,
  31. email: true,
  32. remote: {
  33. url: "http://www.bymyside.online",
  34. type: "get",
  35. data: {
  36. username: function(){
  37. return 12;
  38. }
  39. }
  40. }
  41. },
  42. name: {
  43. required: true,
  44. step: 10
  45. }
  46. }
  47. });
  48. </script>
  49. </body>
  50. </html>