Input Datetime name property
Example
Get the name of the datetime field:
var x = document.getElementById("myDatetime").name;
x
The output is:
bdaytime
Try it »
Definition and Usage
The name property is used to set or return the value of the name property of the datetime field.
The name attribute is typically used as the identifier for submitting form data to the server, or as a reference identifier for JavaScript on the client side.
**Note:** Only after setting the name attribute can data be submitted to the server upon form submission.
Browser support





All major browsers support the name attribute
Note: Supported by Internet Explorer, Firefox, Opera 15 (and later), or Chrome. element using type="datetime".
Syntax
Return the name attribute:
datetimeObject
.name
Set the name attribute:
datetimeObject
.name=
name
Attribute values
| Value | Description |
|---|---|
| name | Describes the name of the datetime field |
Technical Details
| Return Value: | String representing the name of the datetime field |
|---|
More examples
Example
Modify the name of the datetime field:
document.getElementById("myDatetime").name = "newDatetimeName";
Try it »
Related pages
HTML Reference Manual: HTML name attribute
Input Datetime Object