required

Jump to: navigation, search

required

This page has been flagged with the following issues:

High-level issues:


W3C Candidate Recommendation

Summary

The required attribute is a boolean attribute. When present, it specifies that an input field must be filled out before submitting the form.


Applies to HTMLInputElement

Examples

A required input field

HTML

Username: <input type="text" name="username" required>

Notes

Remarks

The attribute can be set on text, text area, URL, email, select, checkbox, or radio button elements. It is a Boolean attribute and needs to be specified only on an element. When users hover the mouse over a required field, they’ll see a tool tip stating that it is a required field. The following example shows the validation attribute on a text input field.

Syntax

Standards information

Compatibility

Desktop

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic Support 22
15
10
12
5.1

Mobile

Feature Android BlackBerry Chrome for mobile Firefox Mobile (Gecko) IE Mobile Opera Mobile Opera Mini Safari Mobile
Basic Support Unsupported
10
?
?
10
?
Unsupported
Unsupported


Compatibility notes

Browser Version Note
Safari 5.1+ Partial support in Safari refers to lack of notice when form with required fields is attempted to be submitted.

See also

Related pages (MSDN)

Attribution

This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]