Javascript examples for DOM HTML Element:Fieldset
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 |
A String, representing the name of the fieldset
The following code shows how to return the value of the name attribute of a fieldset:
<!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>