我想在用户在TextBox中输入文本后清除Radiobutton列表选择。我尝试了以下代码但它似乎没有工作,它没有显示任何错误。如果有任何建议,请告诉我。
function ClearRadioButtonList() {
var checkboxlistid9 = "#<%= rblLst.ClientID %>";
$('.checkboxlistid9').attr('checked',false);
}
<telerik:RadMaskedTextBox ID="txtCode" runat="server" Mask="###-##-####" SelectionOnFocus="CaretToBeginning">
<ClientEvents OnBlur="ClearRadioButtonList" />
</telerik:RadMaskedTextBox>
<asp:RadioButtonList ID="rblLst" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Value="1">Unknown</asp:ListItem>
<asp:ListItem Value="2">Not Applicable</asp:ListItem>
</asp:RadioButtonList>
答案 0 :(得分:2)
$('.checkboxlistid9').each(function (index, elem){
$(elem).prop('checked',false);
})
答案 1 :(得分:0)
如果是基于i-checks的动态单选按钮列表
<table id="Body_TTBody_rblAttendanceStatus" class="i-checks rblStatus">
<tbody>
<tr>
<td>
<div class="iradio_flat-red" style="position: relative;">
<input id="Body_TTBody_rblAttendanceStatus_0" type="radio">
</div>
<label for="Body_TTBody_rblAttendanceStatus_0" class="">Absent</label></td>
</tr>
<tr>
<td>
<div class="iradio_flat-red" style="position: relative;">
<input id="Body_TTBody_rblAttendanceStatus_1" type="radio">
</div>
<label for="Body_TTBody_rblAttendanceStatus_1" class="">Planned Leave</label>
</td>
</tr>
<tr>
<td>
<div class="iradio_flat-red" style="position: relative;">
<input id="Body_TTBody_rblAttendanceStatus_2" type="radio">
</div>
<label for="Body_TTBody_rblAttendanceStatus_2" class="">Present</label></td>
</tr>
<tr>
<td>
<div class="iradio_flat-red" style="position: relative;">
<input id="Body_TTBody_rblAttendanceStatus_3" type="radio">
</div>
<label for="Body_TTBody_rblAttendanceStatus_3" class="">Unplanned Leave</label>
</td>
</tr>
</tbody>
</table>
<script type="text/javascript">
jQuery('#Body_TTBody_rblAttendanceStatus > tbody > tr> td').each(function (index, value) {
if ($(value).find('input[type="radio"]').prop('checked')) {
$(value).find('input[type="radio"]').prop('checked', false);
$(value).find('input[type="radio"]').closest("div").removeClass("checked");
}
});
</script>