HTML Required Attribute

The HTML Required attribute is a Boolean attribute which specifies that the input element must be filled out before the submission of form. This attribute used with the following elements:

  1. <input>
  2. <select>
  3. <textarea>

<input>

We can easily use the required attribute with the <input> element as shown in the following syntax:

Example

Test it Now

Output:

HTML Required Attribute

<select>

We can easily use the required attribute with the <select> element as shown in the following syntax:

Example

Test it Now

Output:

HTML Required Attribute

<textarea>

We can also easily use the required attribute with the <textarea> element as shown in the following syntax:

Example

Test it Now

Output:

HTML Required Attribute

Browser Support

Elementchrome browser Chromeie browser IEfirefox browser Firefoxopera browser Operasafari browser Safari
<required>YesYesYesYesYes

Next TopicHTML Space Code