Fieldset name attribute

Definition and Usage

name Sets or returns the value of the name attribute of the fieldset.

fieldset name attribute Specifies the name of the fieldset field, used to reference form data after submission, or to reference elements in JavaScript.

Tip:Only form elements that have a name attribute will pass their values when submitting the form.

See also:

HTML Reference Manual:HTML <fieldset> Tag

Example

Example 1

Return the value of the name attribute of the fieldset:

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

Try it yourself

Example 2

Change the value of the name attribute of the fieldset:

document.getElementById("myFieldset").name = "newName";

Try it yourself

Syntax

Return the name attribute:

fieldsetObject.name

Set name attribute:

fieldsetObject.name = name

Attribute Value

Value Description
name Specifies the name of the fieldset.

Technical Details

Return Value: A string value that represents the name of the fieldset.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Supported Not Supported Supported Not Supported Supported

Related Pages

HTML Reference Manual:HTML <fieldset> name Attribute