Username: "> Username: " />
Easy Tutorial
❮ Att Embed Height Tag Dt ❯

HTML <input> required Attribute

HTML <input> Tag

Example

HTML form with a required field:

<form action="demo-form.php">
  Username: &lt;input type="text" name="usrname" required>
  <input type="submit">
</form>

Browser Support

The numbers in the table specify the first browser version that fully supports the attribute.

Attribute
required 5.0 10.0 4.0 5.0 9.6

Definition and Usage

The required attribute is a boolean attribute.

The required attribute specifies that an input field must be filled out before submitting the form.

Note: The required attribute works with the following input types: text, search, url, tel, email, password, date pickers, number, checkbox, radio, and file.


Differences Between HTML 4.01 and HTML5

The required attribute is new in HTML5.


Differences Between HTML and XHTML

In XHTML, attribute minimization is forbidden, and the required attribute must be defined as <input required="required" />.


Syntax

❮ Att Embed Height Tag Dt ❯