This article is a mirror article of machine translation, please click here to jump to the original article.

View: 16647|Reply: 1

[Jquery] Validate jQuery html5Validate plugin based on HTML5 forms

[Copy link]
Posted on 9/5/2015 10:08:04 PM | | | |
submit submit in html, if you want to have an onclick click event, and, you also want to validate the form,

If the form is successfully verified, it is fine to execute the onclick event, but if you add the onclick event to the submit button,

The web page will execute the onclick event first, without verifying the form, I looked it up on the Internet, and sent a good js plugin, with the download address below:

Introduce jquery first, then jquery-html5Validate.js

Here's how to use it:

  1. 示意,假设测试表单id为html5Form,则有:
  2. $("#html5Form").html5Validate(function() {
  3.     // 全部验证通过,该干嘛干嘛~~
  4. });
Copy code
The effect is as follows:


However, this prompt effect is too ugly, I want to use the prompt effect that comes with HTML5?

  1. var isIe10 = typeof document.msHidden !== "undefiend";
  2.             $("#html5Form").html5Validate($.noop, {
  3.                 novalidate: isIe10 ? false : true
  4.             });
Copy code




The renderings are much more beautiful, with the js script attached: jquery-html5Validate.js (17.92 KB, Number of downloads: 2)





Previous:[Turn] to jQuery.getJSON caching problem
Next:I will encourage you together
Posted on 4/7/2017 11:54:20 PM |
Very good, thank you for sharing
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com