Disabling a Radio ButtonQuestion: How do I disable a radio button in a form (making it not selectable)?
Answer:
To make a radio button not selectable, in the button's
<INPUT type="radio" name="myButton" value="theValue" onclick="this.checked=false; alert('Sorry, this option is not available!')">In the example below, the "Courier delivery" option is disabled. Try it now - you'll get an alert box with the text Sorry, this option is not available! Note, however, that the above trick won't work if the user has disabled JavaScript. Nevertheless, even without relying on client-side scripting, you can still disable a radio button (as well as form elements of other types) using the attribute disabled within the HTML tag that defines the form element, for example:
<input type=radio name=r1 disabled> .
|
Copyright © 1999-2011, JavaScripter.net.