Input Date name Attribute

Definition and Usage

name Set or return the value of the name attribute of the date 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 the form.

See also:

HTML Reference Manual:HTML <input> name Attribute

Example

Example 1

Get the name of the date field:

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

Try it yourself

Example 2

Change the name of the date field:

document.getElementById("myDate").name = "newDateName";

Try it yourself

Syntax

Return the name attribute:

inputdateObject.name

Set the name attribute:

inputdateObject.name = name

Attribute value

Value Description
name Specifies the name of the date field.

Technical Details

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

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

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

Note:The <input type="date"> element does not display any date field/calendar in IE11 and earlier versions.