HTML button name Attribute

|  | Search W3Schools : |

HOME | HTML | CSS | XML | JAVASCRIPT | ASP | PHP | SQL | MORE... |  | References | Examples | Forum | About

ADVERTISEMENTS XML Certification Download XML editor Custom Programming |  |

Table of contents

HTML Reference
HTML by Alphabet
HTML by Function
HTML Attributes
HTML Events
HTML Colornames
HTML Character Sets
HTML ASCII
HTML ISO-8859-1
HTML Symbols
HTML URL Encode
HTML Lang Codes
HTTP Messages
HTML Tags
<!-->
<!DOCTYPE>
<a>
<abbr>
<acronym>
<address>
<applet>
<area>
<b>
<base>
<basefont>
<bdo>
<big>
<blockquote>
<body>
<br>
<button>
<caption>
<center>
<cite>
<code>
<col>
<colgroup>
<dd>
<del>
<dfn>
<dir>
<div>
<dl>
<dt>
<em>
<fieldset>
<font>
<form>
<frame>
<frameset>
<head>
<h1> - <h6>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<label>
<legend>
<li>
<link>
<map>
<menu>
<meta>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<p>
<param>
<pre>
<q>
<s>
<samp>
<script>
<select>
<small>
<span>
<strike>
<strong>
<style>
<sub>
<sup>
<table>
<tbody>
<td>
<textarea>
<tfoot>
<th>
<thead>
<title>
<tr>
<tt>
<u>
<ul>
<var>

Selected Reading

Web Statistics
Web Glossary
Web Hosting
Web Quality
W3Schools Tutorials
W3Schools Forum
Helping W3Schools

# 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

    <button name="name">

## Syntax Example

    <button name="option1">

## 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!

WEB HOSTING
Ecommerce Components for ASP.NET
$15 Domain Name Registration Save $20 / year!
Buy UK Domain Names Register Domain Names
Cheap Domain Names Cheap Web Hosting
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting

WEB BUILDING
Website Templates Flash Templates Website Builder Internet Business Opportunity
Custom Programming
FREE Trial or Demo Web Content Manager Forms,Web Alerts,RSS
Download XML editor
FREE Flash Website
FREE Web Templates

EDUCATION
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification

HOME or Top of Page |  | Printer Friendly
W3Schools is for training only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy. Copyright 1999-2009 by Refsnes Data. All Rights Reserved.