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