THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML <fieldset> name Attribute

❮ HTML <fieldset> tag

Example

A <fieldset> with a name attribute:

<form action="/action_page.php" method="get">
  <fieldset name="personalia">
    <label for="fname">First name:</label>
    <input type="text" id="fname" name="fname">
  </fieldset>
  <br>
  <button type="button"
  onclick="form.personalia.style.backgroundColor='yellow'">
  Change background color of fieldset</button>
  <input type="submit">
</form>
Try it Yourself »

Definition and Usage

The name attribute specifies a name for a fieldset.

The name attribute is used to reference elements in a JavaScript, or to reference form data after a form is submitted.


Browser Support

Attribute
name Yes 11.0 Yes Yes Yes

Differences Between HTML 4.01 and HTML5

The name attribute is new for the <fieldset> tag in HTML5.


Syntax

<fieldset name="text">

Attribute Values

Value Description
name Specifies the name of the fieldset

❮ HTML <fieldset> tag