required attribute

<input required ='required'>

Explanation

Required attribute is used to make the form invalidated, when user fails/forgets to enter values in input field.

Example Code:

Result :

Username:

DOB:

Contact Num:

Email ID:

  • User must enter values in all the input fields or else the form will not be validated.
  • It is a "Boolean Attribute".

Limitations:

It will function only in Opera, Firefox and Chrome browsers.

Ask Questions

Ask Question