我想在用户在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>
解决方法
代替:
- $('.checkBoxlistid9').attr('checked',false);
尝试:
- $('.checkBoxlistid9').removeAttr('checked');
另外我认为你的jQuery选择器是错误的
- $('.checkBoxlistid9')
我没有在你的asp:RadioButtonList上看到一个类checkBoxlistid9
将查询选择器更改为:
- $("table[id$=rblLst] input:radio:checked").removeAttr("checked");
要么
- $("table[id$=rblLst] input:radio").each(function (i,x){
- if($(x).is(":checked")){
- $(x).removeAttr("checked");
- }
- });