使用 jquery 取消选中单选按钮列表
好的,今天的最后一个问题我保证!
我有以下代码行,其中包含单选按钮列表 (radTopx)
ddlBuyer.Attributes.Add("onclick", "$('#tbxProdAC').val(''); $('#txtbxHowMany').val(''); $('#GridView1').remove() ; $('#radTopx').attr('已检查',false);
我想要实现的是,当单击 ddlBuyer 时,radTopx 的所有单选按钮均未选中。
我目前显然做错了,请有人指出我哪里出了问题?这在单选按钮列表中与标准单选按钮中的工作方式是否不同?
其中#radTopx 表示以下单选按钮列表:
RadioButtonList ID="radTopx"
ListItem>UUF1<ListItem>
ListItem>UUF2<ListItem>
ListItem>UUF3<ListItem>
RadioButtonList
Ok, last question for today I promise!
I have the following line of code that features a radio button list (radTopx)
ddlBuyer.Attributes.Add("onclick", "$('#tbxProdAC').val(''); $('#txtbxHowMany').val(''); $('#GridView1').remove(); $('#radTopx').attr('checked',false); ");
What I am trying to achieve is that when ddlBuyer is clicked, radTopx has all it's radio buttons unchecked.
I am obviously doing this incorrectly at present, please can someone pointout where I have gone wrong? Does this work differently in a radio button list to a standard radio button?
Where #radTopx represents the following radio button list :
RadioButtonList ID="radTopx"
ListItem>UUF1<ListItem>
ListItem>UUF2<ListItem>
ListItem>UUF3<ListItem>
RadioButtonList
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
其中
div#radios
包含所有无线电输入。我假设 ddlBuyer 是被点击的内容的 id。我们无法给出有关
#radTopx
的答案,因为我们不知道它是什么。where
div#radios
encloses all your radio inputs. I'm assumingddlBuyer
is the id of something that gets clicked.We can't give an answer in regard to
#radTopx
since we don't know what it is.非常感谢Carillonator,非常感谢。
下面的代码成功了,我只需要添加“输入”
ddlBuyer.Attributes.Add("onclick", "$('#tbxProdAC').val(''); $('#txtbxHowMany').val(''); $('#GridView1').remove() ; $('#radTopx 输入').attr('已检查',false);
其中#radTopx 是单选按钮列表。
Thank you very much Carillonator, greatly appreciated.
The following code did the trick, I just need to add in the 'input'
ddlBuyer.Attributes.Add("onclick", "$('#tbxProdAC').val(''); $('#txtbxHowMany').val(''); $('#GridView1').remove(); $('#radTopx input').attr('checked',false); ");
Where #radTopx is the radio button list.