Online demonstration address: http://www.shouce.ren/study/api/s/jq--BootstrapValidator-index.html
The usage method is as follows:
1. <form id="defaultForm" method="post" action="target.php"> 2. <div> 3. <label>Username</label> 4. <div> 5. <input type="text" name="username" /> 6. </div> 7. </div> 8. 9. <div> 10. <label>Email</label> 11. <div> 12. <input type="text" name="email" /> 13. </div> 14. </div> 15. 16. <div> 17. <label>Birthday</label> 18. <div> 19. <input type="text" name="birthday" /> (YYYY/MM/DD) 20. </div> 21. </div> 22. 23. <div> 24. <div> 25. <button type="submit" name="signup" value="Sign up">Submit</button> 26. <button type="button" id="validateBtn">Automatic verification</button> 27. <button type="button" id="resetBtn">Reset form</button> 28. </div> 29. </div> 30.</form>1.$('#defaultForm').bootstrapValidator({ 2. message: 'This value is not valid', 3. feedbackIcons: { 4. valid: 'glyphicon glyphicon-ok', 5. invalid: 'glyphicon glyphicon-remove', 6. validating: 'glyphicon glyphicon-refresh' 7. }, 8. fields: { 9. username: { 10. message: 'The username is not valid', 11. validators: { 12. notEmpty: { 13. message: 'The username is required and cannot be empty' 14. }, 15. stringLength: { 16. min: 6, 17. max: 30, 18. message: 'The username must be more than 6 and less than 30 characters long' 19. }, 20. regexp: { 21. regexp: /^[a-zA-Z0-9_/.]+$/, 22. message: 'The username can only consist of alphabetical, number, dot and underscore' 23. }, 24. remote: { 25. url: 'remote.php', 26. message: 'The username is not available' 27. }, 28. different: { 29. field: 'password', 30. message: 'The username and password cannot be the same as each other' 31. } 32. } 33. }, 34. email: { 35. validators: { 36. emailAddress: { 37. message: 'The input is not a valid email address' 38. } 39. } 40. }, 41. } 42.});The above is the full description of Bootstrap Validator form verification introduced to you by the editor. I hope it will be helpful to you. If you want to know more, please pay attention to Wulin.com!