name attribute (input, select, textarea, ...)
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" /> </form> |
||||
|
||||
Did you find this example helpful?
|
Supported by tags:
button, input:button, input:checkbox, input:file, input:hidden, input:password, input:radio, input:range, input:reset, input:search, input:submit, input:text, isIndex, keygen, select, textArea
Related pages:
External links:
name attribute (MSDN)
general elements name attribute (Mozilla Developer Center)
name (Safari Reference Library)
button name attribute (W3C)
input name attribute (W3C)
select name attribute (W3C)
general elements name attribute (Mozilla Developer Center)
name (Safari Reference Library)
button name attribute (W3C)
input name attribute (W3C)
select name attribute (W3C)
User Contributed Comments