<input type="text" name="foo">
<input type="text" name="bar">
<input type="submit" name="submit" value="Test me">
<li><input type="radio" name="rbtn" value="1"> 1st Choice</li>
<li><input type="radio" name="rbtn" value="2"> 2nd Choice</li>
<li><input type="radio" name="rbtn" value="3"> 3rd Choice </li>
The Low Down
name attribute defines the name of the form control, and is submitted along with the form control's value when the form is submitted. It is the name part of the name/value pair associated with an element for the purposes of form submission.
- The value of the
name attribute can't be an empty string, and should be unique, except in the case of
radio, use the same name for all of the radio buttons in each group of radio buttons: only one radio button in a group of same named radio buttons can be selected at a time.
- Though by no means required, you can give a group of checkboxes the same name, though each should have a different value.
- Valid for all input types, and all other form controls. In addition to
<input>, it is also valid on
- When it comes to maps, the
name attribute is how the
<map> can be referenced.
name attribute is required on
name attribute on links and images is now obsolete. Use
name attribute was also valid on applets and frames, which are now obsolete.