Fieldset name Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Fieldset

Description

The name property sets or gets the name attribute of a fieldset.

Set the name property with the following Values

Value Description
name Sets the name of the fieldset

Return Value

A String, representing the name of the fieldset

The following code shows how to return the value of the name attribute of a fieldset:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form>
<fieldset id="myFieldset" name="personalia">
  Name: <input type="text" name="username"><br>
  Email: <input type="text" name="usermail"><br>
</fieldset>
</form>// w  w  w  . ja va  2  s.c om

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

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

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

Related Tutorials