full-example.html 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Full Example</title>
  6. <link rel="stylesheet" href="demo.css">
  7. </head>
  8. <body>
  9. <form class="form" data-validator-option="{timely:2, focusCleanup:true}">
  10. <div class="form-item">
  11. <label class="label">Username</label>
  12. <input type="text" name="username"
  13. data-rule="required;username;"
  14. data-rule-username="[/^[\w\d]{3,12}$/, 'Please enter 3-12 digits, letters, underscores']"
  15. data-tip="You can use letters, numbers and periods"
  16. >
  17. </div>
  18. <div class="form-item">
  19. <label class="label">Password</label>
  20. <input type="password" name="pwd"
  21. data-rule="Password: required; length(8~16)"
  22. data-tip="Please fill in at least eight characters"
  23. >
  24. </div>
  25. <div class="form-item">
  26. <label class="label">Verify Password</label>
  27. <input type="password" name="pwdAgain" data-rule="Verify Password: required; match(pwd)">
  28. </div>
  29. <div class="form-item">
  30. <label class="label">Gender</label>
  31. <select name="gender" data-rule="required">
  32. <option value="">select ...</option>
  33. <option value="1">Male</option>
  34. <option value="2">Female</option>
  35. <option value="3">Other</option>
  36. </select>
  37. </div>
  38. <div class="form-item">
  39. <label class="label">Email</label>
  40. <input type="text" name="email" data-rule="required;email">
  41. </div>
  42. <div class="form-item">
  43. <label class="label">Interest</label>
  44. <label><input type="checkbox" name="interest" data-rule="checked">sports</label>
  45. <label><input type="checkbox" name="interest">movie</label>
  46. <label><input type="checkbox" name="interest">game</label>
  47. </div>
  48. <div class="form-item">
  49. <label class="label">Note</label>
  50. <textarea data-rule="required;"></textarea>
  51. </div>
  52. <div class="form-item">
  53. <label><input type="checkbox" id="agree_arguments" data-rule="checked">I agree to the service agreement.</label>
  54. </div>
  55. <div class="form-item">
  56. <button type="submit">Submit</button>
  57. </div>
  58. </form>
  59. <script src="https://cdn.jsdelivr.net/jquery/1.12.3/jquery.min.js"></script>
  60. <script src="../dist/jquery.validator.min.js?local=en"></script>
  61. </body>
  62. </html>