HTML5 Form Validation Instance

Source: Internet
Author: User

HTML5 new forms validation can greatly reduce your reliance on JavaScript code and allow for rich client-side validation, with two examples below.


1.HTML5 client-side checksum: Checkvalidity method

The Checkvalidity method can be used to verify that your input is legitimate, returns true if it is valid, or false.


<!doctype html>


2. Custom error Hint: Setcustomvalidity method

Unfortunately, many browsers now support this method is not perfect, you need to refresh the page before you can re-enter the correct value, or the error will always exist, please note the reader!

I believe that the future browser support for HTML5 will be gradually improved.

<!doctype html>


HTML5 Form Validation Instance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.