【发布时间】:2015-10-23 18:17:51
【问题描述】:
我有 3 个单选按钮,我需要其中的 2 个来启用文本框。
到目前为止,我已将其设置如下。
<form id="form1" name="form1" method="post" action="">
<table width="250">
<tr>
<td>
<label>
<input type="radio" name="RadioGroup1" value="B1" id="RadioGroup1_0" />Quote
</label>
</td>
<td>
<label>
<input type="radio" name="RadioGroup1" value="B2" id="RadioGroup1_1" />Bind
</label>
</td>
<td>
<label>
<input type="radio" name="RadioGroup1" value="B3" id="RadioGroup1_2" />Quote/Bind
</label>
</td>
</tr>
</table>
<br />
<label>
Effective Date/Time
<input name="EffDate" type="text" id="EffDate" placeholder="yyyy/mm/dd hh:mm HRS" disabled="disabled"/>
</label>
</form>
我设置了一个按钮来启用文本框
$('#RadioGroup1_1').change(function(){
$('#EffDate').removeAttr('disabled');
});
$('#RadioGroup1_2').change(function(){
$('#EffDate').removeAttr('disabled');
});
我的问题是,单击 RadioGroup1_1 或 1_2 后,“effdate”文本框不会回到其禁用状态。我只希望在选择单选按钮时启用该框。
我已经尝试过调查,但找不到我的具体答案,为了全面披露,这对我来说是全新的!
谢谢!
【问题讨论】:
-
首先,如果我回答正确,您不能启用多个单选按钮。使用复选框,您可以启用多个选项
-
@EgySuccess - 您可以启用多个单选按钮,但您不能在同一组中一次检查多个.但这不是问题所在。
-
@nnnnnn 是的,你做到了,我的意思是谢谢
标签: javascript jquery html