Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript/HTML gray out radio list?

Is there a way I can 'gray' out an html radio list input? I know I can actually change the color.. But I want to make it so the radio button list cannot be toggled either. I also want it to 'highlight' or be toggled to a specific radio list while in this state.

So for instance with this radio list:

 <input type="radio" name="group2" value="Water"> Water<br />
 <input type="radio" name="group2" value="Lemonade"> Lemonade<br />
 <input type="radio" name="group2" value="Juice"> Juice<br />

I want the user not to be able to click/change the radio list. And I want the radio button to be associated with the 'Juice' option.

This needs only to be compatible with Internet Explorer.

I cannot use JQuery! Please don't paste JQuery because it will not help me!

Thanks!

like image 977
eatonphil Avatar asked Nov 22 '25 07:11

eatonphil


1 Answers

Simply apply the 'disabled' attribute to the elements that you want disabled and 'checked' to the default.

<input type="radio" name="group2" value="Water" disabled> Water
<input type="radio" name="group2" value="Water"> Lemonade
<input type="radio" name="group2" value="Water" checked> Juice
like image 194
Pastor Bones Avatar answered Nov 24 '25 20:11

Pastor Bones



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!