Input Month requiredProperty
Examples
Find out whether the month field is required before submitting the form:
var x = document.getElementById("myMonth").required;
xThe result is:true
Try it Yourself »
Definition and Usage
The required property sets or returns whether the month 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.
Note:Internet Explorer and Firefox do not support <input> elements with the type="month" attribute.
Syntax
Return the required property:
monthObject.required
Set the required property:
monthObject.required=true|false
Property Values
| Value | Description |
|---|---|
| true|false | Specifies whether the month field is a required part before the form is submitted.
|
Technical Details
| Return Value: | A Boolean value, returns true if the month field is a required part of the form, otherwise returns false. |
|---|
More Examples
Example
Set the month field to be a required part of the form:
document.getElementById("myMonth").required = true;
Try it Yourself »
Related Pages
HTML Reference Manual:HTML <input> required Attribute
Input Month Object Other Extensions