Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio Button Disable 1

Status
Not open for further replies.

durug

Technical User
Mar 22, 2002
335
CA
Hi,

How can I disable a radio button?
 
Me again. But not to put it on a grey background. Just don't give him the option to change it.

Thanks
 
something like this?:
Code:
<form>
<input type=&quot;radio&quot; name=&quot;radio1&quot; onClick=&quot;document.forms[0].radio1[1].checked = 'true'&quot;>
<input type=&quot;radio&quot; name=&quot;radio1&quot; checked>
</form>
hope it helps! Suceess, thats the way you spell success!
Got a question? Ask IMOZRMY!
 
Thanks you a lot! But what if I have the radio button unchecked and I don't want the user to change it.

Durug
 
this should work:
Code:
<form>
<input type=&quot;radio&quot; name=&quot;radio1&quot; onClick=&quot;return false;&quot;>
<input type=&quot;radio&quot; name=&quot;radio1&quot; onClick=&quot;return false;&quot;>
</form>
Suceess, thats the way you spell success!
Got a question? Ask IMOZRMY!
 
The real way to disable a radio button is to just use the HTML property...


<input type=&quot;radio&quot; name=&quot;radio1&quot; disabled=&quot;disabled&quot;>

That should work in any browser that fully supports html 4.01 ===
Supports Mozilla and Web Standards
Knows HTML/XHTML, CSS1, JavaScript, PHP, C++, DOM1
===
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top