/

HTML / CSS / JavaScript Tutorial

HTML Element: <fieldset>

[this page | pdf | back links]

The HTML <fieldset> element groups related elements in a form, and typically draws a box around them.

 

The attributes it can take (other than HTML global attributes and HTML event attributes) include:

 

Attribute

Description

More

disabled

Specified element(s) to be disabled

Here

form

Name of the form that element belongs to

Here

name

Name of element

Here

 

To create or access such an element in JavaScript see here. The corresponding HTML DOM object supports standard DOM properties and methods, and additional properties with the same name and meaning as the attributes of the underlying HTML element referred to above.

 

It also supports the following additional property:

 

Property

Description

More

type

Returns the type of the form element that the fieldset element belongs to

Here

 

The default style applicable to this element is shown here.

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Created using HTML:<br>
<fieldset>Fieldset contents</fieldset>

<br><br>Created using JavaScript:<br>
<span id="element"></span>

<script>
var x = document.createElement("FIELDSET");
x.textContent = "Fieldset contents";
// or use var txt = document.createTextNode("Fieldset contents");
// x.appendChild(txt);
document.getElementById("element").appendChild(x);
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Elements


Desktop view | Switch to Mobile