1. Technology



Required Attribute Description:

The required attribute is an empty attribute that defines the required fields in an HTML form.

This attribute is valid in HTML5.

The Required Attribute is Used with These Tags:

The Required Attribute Contains:

The required attribute is an empty attribute. This means you can write just the word “required” in the field and that field will be required. If you are writing XHTML, you can write required="required" to be valid.

Here is an example of an INPUT field with a required attribute.

<input type="url" id="URL" required>

Here is an example of that field in XHTML:

<input type="url" id="URL" required="required" />

Required Default Value:

The required attribute is empty and doesn’t have any value.

Required is Valid in HTML Versions:

  • HTMl5
  • XHTML5

Required Attribute DTD:


<doctype html>

©2014 About.com. All rights reserved.