Javascript examples for DOM HTML Element:Fieldset
The disabled property sets or gets whether a form fieldset is disabled.
This property reflects the HTML disabled attribute.
Set the disabled property with the following Values
Value | Description |
---|---|
true|false | Sets whether a group of related form elements (a fieldset) should be disabled |
A Boolean, returns true if the fieldset is disabled, otherwise it returns false
The following code shows how to disable a fieldset:
<!DOCTYPE html> <html> <body> <form> <fieldset id="myFieldset"> <legend>Personalia:</legend> Name: <input type="text"><br> Email: <input type="text"><br> Date of birth: <input type="text"> </fieldset> </form>/* w w w . j a va2 s .com*/ <button onclick="myFunction()">Test</button> <script> function myFunction() { document.getElementById("myFieldset").disabled = true; } </script> </body> </html>