Fieldset type Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Fieldset

Description

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>
<html>
<body>

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

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

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

<script>
function myFunction() {
    var x = document.getElementById("myFieldset").type;
    document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>

Related Tutorials