Input Email requiredProperty
Examples
Check whether the email field is required before submitting the form:
var x = document.getElementById("myEmail").required;
xThe output result is:true
Try it yourself »
Definition and Usage
The required property is used to set or return whether the email field is a required field in the form.
This property reflects the HTML required attribute.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the required attribute, except Internet Explorer 9 and earlier IE versions, and Safari browser.
Note:Internet Explorer 9 (and earlier IE versions), or Safari browser, does not support HTML <input> elements with type="email".
Syntax
Return the required property:
emailObject.required
Set the required property:
emailObject.required=true|false
Property Values
| Value | Description |
|---|---|
| true|false | Describes whether the email field is a required part before form submission.
|
Technical Details
| Return Value: | A Boolean value, returns true if the email field is a required part of the form, otherwise returns false. |
|---|
More Examples
Example
Set the email field as a required part of the form:
document.getElementById("myEmail").required = true;
Try it yourself »
Related Pages
HTML Reference Manual:HTML <input> required attribute
Input Email Object Other Extensions