HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML <button> name Attribute

HTML button Tag Reference HTML <button> tag

Example

Two buttons with equal names, that submit different values when clicked:

<form action="demo_form.asp" method="get">
  Choose your favorite subject:
  <button name="subject" type="submit" value="HTML">HTML</button>
  <button name="subject" type="submit" value="CSS">CSS</button>
</form>

Try it Yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The name attribute is supported in all major browsers.


Definition and Usage

The name attribute specifies the name for a <button> element.

The name attribute is used to reference form-data after the form has been submitted, or to reference the element in a JavaScript.

Tip: Several <button> elements can share the same name. This allows you to have several buttons with equal names, which can submit different values when used in a form.


Differences Between HTML 4.01 and HTML5

NONE.


Syntax

<button name="name">

Attribute Values

Value Description
name The name of the button


HTML button Tag Reference HTML <button> tag

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE