HTML <button> name eigenschap

Definitie en gebruik

name Eigenschap definieert de naam van het <button> element.

name Attributes are used to refer to form data after submitting the form, or to refer to the element in JavaScript.

Tip:Multiple <button> elements can share the same name. This allows you to have multiple buttons with the same name that can submit different values when used in a form.

Example

Two buttons with the same name, submit different values when clicked:

<form action="/action_page.php" method="get">
  Please select 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

Syntax

<button name="name">

Attribute value

Value Description
name Specify the name of the button.

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support