English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
O atributo name especifica o nome do elemento <button>, vários elementos <button> podem compartilhar o mesmo nome. Isso permite que você use vários botões com o mesmo nome, que, ao serem usados em formulários, poderão submeter valores diferentes
Dois botões com o mesmo nome, ao serem clicados, submeterão valores diferentes:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Uso do atributo name do elemento <button> em HTML-Tutorial Básico(oldtoolbag.com)</title> </head> <body> <form action="action_page.php" method="get"> Escolha o tema que você deseja favoritar: <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. |