Input Number nameProperty
Examples
Get the name of the number field:
var x = document.getElementById("myNumber").name;
xThe output result is:quantity
Try it yourself »
Definition and Usage
The name property is used to set or return the value of the name attribute of the number field.
The name attribute is typically used as an identifier for 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 data be submitted to the server after form submission.
Browser Support
![]()
![]()
![]()
![]()
![]()
All mainstream browsers support the name attribute
Note:Internet Explorer 9 and earlier IE versions do not support <input> elements with the type="number" attribute.
Syntax
Return the name property:
numberObject.name
Set the name property:
numberObject.name=name
Property Values
| Value | Description |
|---|---|
| name | Describes the name of the number field |
Technical Details
| Return value: | A string representing the name of the number field |
|---|
More Examples
Example
Modify the name of the number field:
document.getElementById("myNumber").name = "newNumberName";
Try it yourself »
Related Pages
HTML Reference Manual:HTML <input> name attribute
Input Number Object Other Extensions