Home >Web Front-end >H5 Tutorial >The definition of valid, invalid and required in html5_html5 tutorial skills

The definition of valid, invalid and required in html5_html5 tutorial skills

WBOY
WBOYOriginal
2016-05-16 15:48:222607browse

css3 prompt only applies to advanced browsers:

Chrome
Firefox
Safari
IE9

The definitions of valid, invalid, and required

The code is as follows

Copy code
The code is as follows:

input:required, input:valid, input: invalid{border:0 none; outline: 0 none; -webkit-box-shadow:none; -moz-box-shadow:none; -ms-box-shadow:none; -o-box-shadow:none; box- shadow: none;}

In the past, verification forms would use js and regular expressions to determine whether the filled-in content was correct, such as email verification.

The emergence of HTML5 provides us with some attributes, so we can solve this inspection form content without writing js and regular expressions.
:required
Must, that means the input cannot be empty.

:valid
is valid, that is, it is triggered when the filled in content meets the requirements.

:invalid
Invalid, which is triggered when the filled in content does not meet the requirements.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn