Javascript examples for DOM HTML Element:Input Radio
The disabled property sets or gets whether a radio button should be disabled.
This property reflects the HTML disabled attribute.
Set the disabled property with the following Values
Value | Description |
---|---|
true|false | Sets whether a radio button should be disabled |
A Boolean, returns true if the radio button is disabled, otherwise it returns false
The following code shows how to disable a radio button:
<!DOCTYPE html> <html> <body> Radio Button: <input type="radio" id="myRadio"><br> <button onclick="myFunction()">Test</button> <script> function myFunction() {/* w w w. j a va 2 s . co m*/ document.getElementById("myRadio").disabled = true; } </script> </body> </html>