English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The name attribute specifies the name of the <button> element, several <button> elements can share the same name. This allows you to use multiple buttons with the same name, which can submit different values when used in a form
Two buttons with the same name, which submit different values when clicked:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML <button> name Attribute Usage-Basic Tutorial(oldtoolbag.com)</title> </head> <body> <form action="action_page.php" method="get"> Select the theme you want to collect: <button name="subject" type="submit" value="HTML">HTML</button> <button name="subject" type="submit" value="CSS">CSS</button> </form> </body> </html>Test and see ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the name attribute.
The name attribute specifies the name of the <button> element.
The name attribute is used to reference form data after form submission, or to reference elements in JavaScript.
Hint: Several <button> elements can share the same name. This allows you to use multiple buttons with the same name that can submit different values when used in a form.
None.
<button name="name">
Value | Description |
---|---|
name | Specifies the name of the button. |