<input> - month
HTML DOM Input Month object
Input Month object
The Input Month object is new in HTML5.
The Input Month object represents an HTML <input> element with type="month".
Note: Internet Explorer or Firefox browsers do not support <input> elements with the type="month" attribute.
Access the Input Month object
You can use the getElementById() function to access <input> elements with the type="month" attribute:
var x = document.getElementById("myMonth");
Tip: You can also access the Input Month object through the form's elements collection.
Create an Input Month object
You can use the document.createElement() method to create an <input> element with the type="month" attribute:
var x = document.createElement("INPUT");
x.setAttribute("type", "month");
Input Month object properties
Attribute | 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 page load |
defaultValue | Set or return the default value of the month field |
disabled | Sets or returns whether the month field is available |
form | Returns a form reference using the month field |
list | Returns a datalist reference containing the month field |
max | Sets or returns the value of the max property of the month field |
min | Sets or returns the value of the min property 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 required in the form |
step | Sets or returns the value of the step property 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
Input Month objects also support standard properties and events .
Related articles
HTML Tutorial: HTML Forms
HTML Reference Manual: HTML <input> Tag
HTML Reference Manual: HTML <input> type attribute