ປະສົມ HTML <button> name

ການອະທິບາຍ ແລະ ການນຳໃຊ້

name ການກຳນົດຂອງປະສົມຂອງ <button>.

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, which 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 Define the name of the button.

Browser Support

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