Return the value of the name attribute of a button:
The result of x will be:
The name property sets or returns the value of the name attribute of a button.
The name attribute specifies the name of a button, and is used to reference form data after it has been submitted, or to reference the element in a JavaScript.
The name property is supported in all major browsers.
Return the name property:
Set the name property:
Value | Description |
---|---|
name | Specifies the name of the button |
Return Value: | A String, representing the name of the button |
---|
Change the value of the name attribute of a button:
HTML reference: HTML <button> name attribute