Input Month required Property
Example
Check whether the month field is a required field before submitting the form:
var x = document.getElementById("myMonth").required;
x
The output is:
true
Try it »
Definition and Usage
The required property is used to set or return whether the month field is a required field in the form.
This attribute reflects the HTML required attribute.
Browser support





All major browsers support the required attribute, except Internet Explorer 9 and earlier versions and the Safari browser.
**Note:** Internet Explorer or Firefox browsers do not support the HTML using the type="month" attribute .
Syntax
Return the required attribute:
monthObject
.required
Set the required attribute:
monthObject
.required=true|false
Attribute values
| Value | Description |
|---|---|
| true|false | Describes whether the month field is a required part before the form is submitted.
|
Technical Details
| Return Value: | Boolean, returns true if the month field is a required part of the form, otherwise returns false. |
|---|
More examples
Example
Set the month field as a required part of the form:
document.getElementById("myMonth").required = true;
Try it »
Related pages
HTML Reference Manual: HTML required attribute
Input Month Object