You are here: Reference > HTML > attributes > name (input, select, textarea, ...)

name attribute (input, select, textarea, ...)

Browser support:
Sets the name of a form control that affects the contents of the message submitted to the server.
  • The name attribute is useful for submitting data to a server. The contents of the submitted message represent the state of the named form controls in a form tag.
    For details, see the page for the form element.
  • The name attribute has additional meaning for radio buttons. You can define groups with the name attribute of the radio buttons. Radio buttons with the same name belong to the same group. Radio buttons with different names belong to different groups. Within a group, only one radio button can be checked.
  • The name attribute has effect on Autocomplete windows, too. You can enable the Autocomplete window for an input:password or an input:text element in a form with the autoComplete attribute. The contents of the Autocomplete window depend on the value of the name attribute. If you don't want to change the value of the name attribute because of the Autocomplete window, you can use the vCard_name attribute in Internet Explorer.
    See the page for the autoComplete or the vCard_name attribute for further details on Autocomplete windows.
JavaScript page for this attribute: name. You can find other example(s) there.

Possible values:

String that sets the name of the form control.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the name attribute for form elements:
<form action="#URL#" method="post">
    User Name: <input type="text" name="userName" />
    <br />
    Password: <input type="password" name="password" />
    <br />
    <input type="submit" value="Sign in" />
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content