The Fieldset object represents an HTML <fieldset> element.
We can access a <fieldset> element via document.getElementById()
:
var x = document.getElementById("myFieldset");
Click the button to disable the fieldset.
<!DOCTYPE html> <html> <body> <fieldset id="myFieldset" name="MyNameFieldset"> Name: <input type="text" name="username"><br> Email: <input type="text" name="usermail"><br> </fieldset> <button onclick="myFunction()">Test</button> <script> function myFunction() {//from w ww . j a v a 2s.c o m var x = document.getElementById("myFieldset"); x.disabled = true; } </script> </body> </html>