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 side using JavaScript.

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

See also:

HTML reference manual:Attribut name de <input> HTML

Instance

Example 1

Get the name of the local date-time field:

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

Try it yourself

Example 2

Change the name of the local date-time field:

document.getElementById("myLocalDate").name = "newDatetimeName";

Try it yourself

Syntax

Return the name attribute:

datetimelocalObject.name

Set the name attribute:

datetimelocalObject.name = name

Attribute value

Value Description
name Définit le nom du champ de date et heure locale.

Détails techniques

Valeur de retour : Valeur de chaîne, représentant le nom du champ de date et heure locale.

Support du navigateur

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

Tous les navigateurs principaux le supportent name Attribut.

Remarque :Internet Explorer ou Firefox ne prennent pas en charge l'élément <input type="datetime-local">.