Fieldset type Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Fieldset


The type property returns the type of form fieldset element.

For a fieldset, this property will always return "fieldset".

This property is read only.

Return Value

A string, representing the type of form element the fieldset is

The following code shows how to return which type of form element the fieldset is:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

  <fieldset id="myFieldset">
    Name: <input type="text"><br>
    Email: <input type="text"><br>
    Date of birth: <input type="text">
</form>/*from  w  w w  .j  a va2s .co  m*/

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

function myFunction() {
    var x = document.getElementById("myFieldset").type;
    document.getElementById("demo").innerHTML = x;

Related Tutorials