Input Month name attribute

Definition and Usage

name Set or return the value of the name attribute of the month field.

The HTML name attribute is used to identify form data after the form data is submitted to the server, or to reference form data on the client using JavaScript.

Note:Only form elements that have a name attribute will pass their values when submitting a form.

See also:

HTML Reference Manual:HTML <input> name Attribute

Example

Example 1

Get the name of the month field:

var x = document.getElementById("myMonth").name;

Try it yourself

Example 2

Change the name of the month field:

document.getElementById("myMonth").name = "newMonthName";

Try it yourself

Syntax

Return the name attribute:

monthObject.name

Set the name attribute:

monthObject.name = name

Attribute Value

Value Description
name Specifies the name of the month field.

Technical Details

Return Value: A string value representing the name of the month field.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support

Note:The <input type="month"> element does not display any date field/calendar in Firefox.