Input DatetimeLocal name attribute
Definition and Usage
name
Set or return the value of the name attribute of the local date-time 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 local date-time field:
var x = document.getElementById("myLocalDate").name;
Example 2
Change the name of the local date-time field:
document.getElementById("myLocalDate").name = "newDatetimeName";
Syntax
Return the name attribute:
datetimelocalObject.name
Set the name attribute:
datetimelocalObject.name = name
Attribute value
Value | Description |
---|---|
name | Specifies the name of the local date-time field. |
Technical Details
Return Value: | A string value representing the name of the local date-time field. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Supported | Supported | Supported | Supported | Supported |
All major browsers support name
Properties.
Note:Internet Explorer or Firefox does not support the <input type="datetime-local"> element.