Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML DOM Input Month object


May 06, 2021 JavaScript with HTML DOM Reference book


Table of contents


HTML DOM Input Month object


Input Month object

Input Month objects are new to HTML5.

The Input Month object represents an HTML-lt;input-gt; element that uses type "month".

Note: Internet Explorer or Firefox browsers do not support the use of the type-"month" property.

Access the Input Month object

You can use the getElementById() function to access the elements that use the type-"month" property:

var x = document.getElementById("myMonth"); Give it a try

Tip: You can also access the Input Month object through the form's collection of elements.

Create an Input Month object

You can use the document.createElement() method to create an element that uses the type-"month" property:

var x = document.createElement("INPUT");
x.setAttribute("type", "month"); Give it a try

Input Month object properties

Property Describe
autocomplete Set or return the autocomplete property value for the month field
autofocus Set or return whether the month field automatically gets focus after the page is loaded
defaultValue Set or return the default value for the month field
disabled Set or return whether the month field is available
form Returns a form reference that uses the month field
list Returns a datalist reference that contains the month field
max Set or return the max property value of the month field
min Set or return the min property value of the month field
name Set or return the name property value of the month field
readOnly Set or return whether the month field is read-only
required Set or return whether the month field is required in the form
step Set or return the step property value of the month field
type Returns the type of form element in the month field
value Set or return the value property value 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 slt;input.gt; Tags

HTML Reference Manual: HTML slt;input> type property