Fieldset name Property - Change the value of the name attribute of a fieldset: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Fieldset

Description

Fieldset name Property - Change 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 . j a va  2 s. c o m*/

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

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

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

Related Tutorials