HTML DOM Input Month Object
- Previous Page <input> image
- Next Page <input> number
Month Object
The Month object is a new object in HTML5.
The Month object represents the HTML <input type="month"> element.
Note:Internet Explorer or Firefox does not support the <input type="month"> element.
Access Month Object
You can access the <input type="month"> element by using getElementById():
var x = document.getElementById("myMonth");
Hint:You can also traverse the form's elements collection To access the Month object.
Create Month Object
You can create an <input type="month"> element by using the document.createElement() method:
var x = document.createElement("INPUT"); x.setAttribute("type", "month");
Month Object Properties
Properties | Description |
---|---|
autocomplete | Set or return the value of the month field's autocomplete attribute. |
autofocus | Set or return whether the month field should automatically focus after the page is loaded. |
defaultValue | Set or return the default value of the month field. |
disabled | Set or return whether the month field is disabled. |
form | Return a reference to the form containing the month field. |
list | Return a reference to the datalist containing the month field. |
max | Set or return the value of the month field's max attribute. |
min | Set or return the value of the month field's min attribute. |
name | Set or return the value of the month field's name attribute. |
readOnly | Set or return whether the month field is read-only. |
required | Set or return whether the month field must be filled out before submitting the form. |
step | Set or return the value of the month field's step attribute. |
type | Return the form element type of the month field. |
value | Set or return the value of the month field's value attribute. |
Input Month Object Methods
Method | Description |
---|---|
select() | Select the content of the month text field. |
stepDown() | Decrement the value of the month field by a specified number. |
stepUp() | Increment the value of the month field by a specified number. |
Standard properties and events
The Month object supports standardsPropertiesandEvents.
Related Pages
HTML Tutorial:HTML Forms
HTML Reference Manual:HTML <input> tag
HTML Reference Manual:HTML <input> type attribute
- Previous Page <input> image
- Next Page <input> number