THE WORLD'S LARGEST WEB DEVELOPER SITE

Fieldset name Property

❮ Fieldset Object

Example

Return the value of the name attribute of a fieldset:

var x = document.getElementById("myFieldset").name;

The result of x will be:

personalia
Try it Yourself »

Definition and Usage

The name property sets or returns the value of the name attribute of a fieldset.

The name attribute specifies the name of the fieldset field, and is used to reference form-data after it has been submitted, or to reference the element in a JavaScript.

Note: Only form elements with a name attribute will have their values passed when submitting a form.


Browser Support

Property
name Yes Not supported Yes Not supported Yes


Syntax

Return the name property:

fieldsetObject.name

Set the name property:

fieldsetObject.name = name

Property Values

Value Description
name Specifies the name of the fieldset

Technical Details

Return Value: A String, representing the name of the fieldset

More Examples

Example

Change the value of the name attribute of a fieldset:

document.getElementById("myFieldset").name = "newName";
Try it Yourself »

Related Pages

HTML reference: HTML <fieldset> name attribute


❮ Fieldset Object