使用 jquery 取消选中单选按钮列表

发布于 2024-08-12 22:00:52 字数 633 浏览 8 评论 0原文

好的,今天的最后一个问题我保证!

我有以下代码行,其中包含单选按钮列表 (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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

糖粟与秋泊 2024-08-19 22:00:52
$('#ddlBuyer').click(function() {
    $('div#radios input').attr('checked',false);
});

其中 div#radios 包含所有无线电输入。我假设 ddlBuyer 是被点击的内容的 id。

我们无法给出有关 #radTopx 的答案,因为我们不知道它是什么。

$('#ddlBuyer').click(function() {
    $('div#radios input').attr('checked',false);
});

where div#radios encloses all your radio inputs. I'm assuming ddlBuyer 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.

浅听莫相离 2024-08-19 22:00:52

非常感谢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.

谁对谁错谁最难过 2024-08-19 22:00:52
$('#radTopx').prop('checked',false); 
$('#radTopx').prop('checked',false); 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文