HTML button name Attribute
HTML <button> tag
Definition and Usage
The name attribute is used to identify form data after it has been submitted.
Several button elements may share the same name attribute (unlike the unique
id attribute). This allows you to have more than one button with the same name,
that can submit different values when used in a form.
Important: Be careful when using the button element in a form. In a form
the different browsers will submit different values. Internet Explorer will
submit the text between the <button> and </button> tags, while other browsers
will send the content of the value attribute. When in a form, use the
input element instead.
Syntax
Syntax Example
Attribute Values
Value |
Description |
name |
Specifies the name of the button. |
Browser Support

The attribute is supported in all major browsers.
Note: When used in a form, Internet Explorer will
submit the text between the <button> and </button> tags, while other browsers
will send the content of the value attribute.
Example
<form name="select" action="demo_button_name.asp" method="get">
Select one:
<br/>
<button name="option" value="html" type="submit">HTML</button>
<br />
<button name="option" value="xhtml" type="submit">XHTML</button>
</form>
|
Note: In the example above we have added the type attribute. This is
to ensure that all browsers will treat this as a submit button. See the
type attribute for an explanation.
Try-It-Yourself Demos
button name
attribute example
Set the name attribute of a button element.
HTML <button> tag
Learn XML with <oXygen/> XML Editor - Free Trial!
 |
|
oXygen helps you learn to define,
edit, validate and transform XML documents. Supported technologies include XML Schema,
DTD, Relax NG, XSLT, XPath, XQuery, CSS.
Understand in no time how XSLT and XQuery work by using the intuitive oXygen debugger!
Do you have any XML related questions? Get free answers from the oXygen
XML forum
and from the video
demonstrations.
Download a FREE 30-day trial today!
|
|