Advertisement
Home Open Editor ❯

HTML <button> name Attribute

Example

<form action="action.php" method="get">
  Click the button.
  <button name="subject" type="submit" value="HTML">HTML</button>
  <button name="subject" type="submit" value="CSS">CSS</button>
  <button name="subject" type="submit" value="JavaScript">JavaScript</button>
</form>

Try this code ❯

Meaning

The name attribute is used to define a name for the button so that it can be scripted by older browsers or used to provide a name for submit buttons when a page has more than one.

The id attribute is preferred for scripting purposes.

Note: Unlimited number of <button> elements can share the same name.


Standard Syntax

<button name="name">


Advertisement

Attribute Values

Value Description
name The name of the button.
Home Open Editor ❯
Advertisement