灰暗禁用的radiobutton文本

时间:2011-06-28 06:59:18

标签: jquery html

我在点击之前的单选按钮时禁用了单选按钮,但我也希望灰显残疾单选按钮的文本,请你帮我。 请找到我为禁用radiobuttons所做的以下代码:

<script type="text/javascript">

    $('input[name=SELECT___2100___32]:eq(0)').click(function() {

        $('input[name=SELECT___2100___33]:eq(2)').val().hide();

        //        alert("hello");
        $('input[name=SELECT___2100___33]:eq(1)').attr('disabled', 'disabled')
        $('input[name=SELECT___2100___33]:eq(2)').attr('disabled', 'disabled')

        $('input[name=SELECT___2100___33]:eq(3)').attr('disabled', 'disabled')
        $('input[name=SELECT___2100___34]').attr('disabled', 'disabled')
        $('input[name=SELECT___2100___40]:eq(2)').attr('disabled', 'disabled')
        $('input[name=SELECT___2100___40]:eq(3)').attr('disabled', 'disabled')

    });
</script>



<tr>
    <td valign="top" align="right">
        Lens Style:
    </td>
    <td>
    </td>
    <td>
        <input type="radio" onclick="change_option('SELECT___2100___32',this.value)" value="163" name="SELECT___2100___32">
            Computer Lens<br>
        <input type="radio" onclick="change_option('SELECT___2100___32',this.value)" value="110" name="SELECT___2100___32">
            Progressive (No Line), starts from $50.00 [Add $50.00]<br>
        <input type="radio" onclick="change_option('SELECT___2100___32',this.value)" value="111" name="SELECT___2100___32">
            Regular Bifocals (w/Line) [Add $39.00]<br>
        <input type="radio" onclick="change_option('SELECT___2100___32',this.value)" value="112" name="SELECT___2100___32">
            Single Vision for Distance [Add $27.00]<br>
        <input type="radio" onclick="change_option('SELECT___2100___32',this.value)" value="113" name="SELECT___2100___32">
            Single Vision for Reading [Add $27.00]<br>
    </td>
</tr>


<tr>
    <td valign="top" align="right">
        Color Type<font color="#cc0000">*</font>:
    </td>
    <td>
    </td>
    <td>
        <input type="radio" onclick="change_option('SELECT___2100___33',this.value)" value="114" name="SELECT___2100___33">
            Clear [Add $27.00]<br>
        <input type="radio" onclick="change_option('SELECT___2100___33',this.value)" value="117" name="SELECT___2100___33">
            Fashion Tint Sunglasses [Add $39.00]<br>
        <input type="radio" onclick="change_option('SELECT___2100___33',this.value)" value="115" name="SELECT___2100___33">
            Photochromic / Transitions [Add $65.00]<br>
        <input type="radio" onclick="change_option('SELECT___2100___33',this.value)" value="116" name="SELECT___2100___33">
            Polarized Sunglass Lens [Add $75.00]<br>
    </td>
</tr>

2 个答案:

答案 0 :(得分:2)

如果您将文字放在一个范围内,则可以使用fadeTo来“淡化”文字。

Example jsFiddle

答案 1 :(得分:0)

您可以使用<span id="xyz">包装文本并切换样式类。

 .disable {
      text-color:#ccc;
 }

 $('input[name=SELECT___2100___33]:eq(1)').attr('disabled', 'disabled')
 $('#163').toggleClass("disable");

 <span id="163">Computer Lens</span>