Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/myscript/public_html/classes/classdb.php on line 42
Required | Input Attribute | HTML5 Tutorial | Example

required attribute

<input required ='required'>


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

Example Code:

Result :



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".


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

Ask Questions

Ask Question