Input Datetime nameProperty
Example
Get the name of the datetime field:
var x = document.getElementById("myDatetime").name;
xThe output is:bdaytime
Try it Yourself »
Definition and Usage
The name property is used to set or return the value of the name attribute of the datetime field.
The name attribute is usually used as an identifier when submitting form data to the server, or as a reference identifier for JavaScript on the client side.
Note:Only when the name attribute is set can form data be submitted to the server after form submission.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the name property
Note:Internet Explorer, Firefox, Opera 15 (and later versions), or Chrome support the <input> element with type="datetime".
Syntax
Return the name property:
datetimeObject.name
Set the name property:
datetimeObject.name=name
Property Values
| Value | Description |
|---|---|
| name | Specifies the name of the datetime field |
Technical Details
| Return Value: | A string representing the name of the datetime field |
|---|
More Examples
Example
Change the name of the datetime field:
document.getElementById("myDatetime").name = "newDatetimeName";
Try it Yourself »
Related Pages
HTML Reference Manual:HTML <input> name Attribute
Input Datetime Object Other Extensions