<!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>
<p>Click the button to display the new name of the fieldset.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("myFieldset").name = "newName";
document.getElementById("demo").innerHTML = document.getElementById("myFieldset").name;
}
</script>
</body>
</html>