Input Email required Attribute
Definition and Usage
required
Set or return whether the email field must be filled out before submitting the form.
This attribute reflects the HTML required attribute.
See also:
HTML Reference Manual:HTML <input> required Attribute
Example
Example 1
Determine whether the email field must be filled out before submitting the form:
var x = document.getElementById("myEmail").required;
Example 2
Set the email field as a required part of the form submission:
document.getElementById("myEmail").required = true;
Syntax
Return the required attribute:
emailObject.required
Set the required attribute:
emailObject.required = true|false
Attribute value
Value | Description |
---|---|
true|false |
Define whether the email field should be a required part of the form submission.
|
Technical Details
Return Value: | Boolean value, returned if the email field is a required part of the form submission. true ; otherwise return false . |
---|
Browser Support
The numbers in the table indicate the first browser version to fully support this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |