HTML DOM Input Month Object
Input Month Object
The Input Month object is new in HTML5.
The Input Month object represents an HTML element using type="month" .
**Note:** Internet Explorer or Firefox browsers do not support the HTML using the type="month" attribute .
Accessing the Input Month Object
You can use the getElementById() function to access the one using the type="month" attribute element:
var x = document.getElementById("myMonth");
Try it
Tip: You can also access the Input Color object through a form'sElementcollection to access the Input Month object.
Creating the Input Month Object
You can use the document.createElement() method to create the one using the type="month" attribute element:
var x = document.createElement("INPUT");
x.setAttribute("type", "month");
Try it
Input Month Object Properties
| property | Description |
|---|---|
| autocomplete | Sets or returns the value of the autocomplete attribute of the month field |
| autofocus | Sets or returns whether the month field automatically gets focus after the page loads |
| defaultValue | Sets or returns the default value of the month field |
| disabled | Sets or returns whether the month field is available |
| form | Returns a reference to the form that uses the month field |
| list | Returns a reference to the datalist containing the month field |
| max | Sets or returns the value of the max attribute of the month field |
| min | Sets or returns the value of the min attribute of the month field |
| name | Sets or returns the value of the name attribute of the month field |
| readOnly | Sets or returns whether the month field is read-only |
| required | Sets or returns whether the month field is a required field in the form |
| step | Sets or returns the value of the step attribute of the month field |
| type | Returns the form element type of the month field |
| value | Sets or returns the value of the value attribute of the month field |
Standard properties and events
The Input Month object also supports the standard property and Events.
Related Articles
HTML Tutorial: HTML Forms
HTML Reference Manual: HTML tag
HTML Reference Manual: HTML type Attribute