Fieldset nameProperty

Fieldset 对象参考手册Fieldset Object

Examples

Return the value of the fieldset's name attribute:

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

xThe output result is:

personalia

Try it yourself »

Definition and Usage

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

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

Note:Only form elements with a name attribute pass their values when submitting the form.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All mainstream browsers support the name attribute, except Internet Explorer and Safari.

Note:Opera 12 and earlier versions do not support the name attribute.


Syntax

Return the name attribute:

fieldsetObject.name

Set the name attribute:

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

Examples

Change the value of the fieldset's name attribute:

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

Try it yourself »


Related Articles

HTML Reference Manual:HTML <fieldset> name Attribute


Fieldset 对象参考手册Fieldset Object

Other Extensions