使用JQUERY禁用带有无线电盒的tr

时间:2012-10-31 02:39:31

标签: jquery

我的代码如下:

$(document).ready(function(){
        $(".trHide input:radio").attr('disabled',true);
     });
 <tr>
      <td><ul type="circle">
          <li>9. Capacité à rendre compte</li>
        </ul></td>
      <td></td>
      <td><input class="validate[required] radio" type="radio" name="number9" value="1" <?php if($value['9.CapasityRendre'] == 1):?>checked='checked'<?php endif; ?>></td>
      <td><input class="validate[required] radio" name="number9" type="radio" value="2" <?php if($value['9.CapasityRendre'] == 2):?>checked='checked'<?php endif; ?>></td>
      <td><input class="validate[required] radio" name="number9" type="radio" value="3" <?php if($value['9.CapasityRendre'] == 3):?>checked='checked'<?php endif; ?>></td>
      <td><input class="validate[required] radio" name="number9" type="radio" value="4" <?php if($value['9.CapasityRendre'] == 4):?>checked='checked'<?php endif; ?>></td>
      <td><input class="validate[required] radio" name="number9" type="radio" value="5" <?php if($value['9.CapasityRendre'] == 5):?>checked='checked'<?php endif; ?>></td>
    </tr>
    <tr class="trHide">
      <td><ul type="circle">
          <li>10. Capacité à faire des choix et à prendre des décisions</li>
        </ul></td>
      <td></td>
      <td><input class="validate[required] radio" type="radio" name="number10" value="1"<?php if($value['10.CapaciteFair'] == 1):?>checked='checked'<?php endif; ?>></td>
      <td><input class="validate[required] radio" name="number10" type="radio" value="2"<?php if($value['10.CapaciteFair'] == 2):?>checked='checked'<?php endif; ?>></td>
      <td><input class="validate[required] radio" name="number10" type="radio" value="3"<?php if($value['10.CapaciteFair'] == 3):?>checked='checked'<?php endif; ?>></td>
      <td><input class="validate[required] radio" name="number10" type="radio" value="4"<?php if($value['10.CapaciteFair'] == 4):?>checked='checked'<?php endif; ?>></td>
      <td><input class="validate[required] radio" name="number10" type="radio" value="5"<?php if($value['10.CapaciteFair'] == 5):?>checked='checked'<?php endif; ?>></td>
    </tr>

我需要:

我想禁用标记<tr class="trHide">中的所有广播框。

问题:

它不起作用。我会解决这个问题吗?请任何人帮助我,谢谢。

1 个答案:

答案 0 :(得分:0)

尝试禁用而不是true,如下所示

$(document).ready(function(){
    $(".trHide input:radio").attr('disabled','disabled');
});