使用jQuery取消选中单选按钮列表 [英] Unchecking radiobutton list using jquery

查看:418
本文介绍了使用jQuery取消选中单选按钮列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我下面的代码行具有单选按钮列表(radTopx)

ddlBuyer.Attributes.Add("onclick", "$('#tbxProdAC').val(''); $('#txtbxHowMany').val(''); $('#GridView1').remove(); $('#radTopx').attr('checked',false); ");

我想要实现的是,当单击ddlBuyer时,radTopx的所有单选按钮都未被选中.

我目前显然做错了,请有人指出我出了错吗?在单选按钮列表中,其工作方式与标准单选按钮是否有所不同?

其中#radTopx代表以下单选按钮列表:

RadioButtonList ID="radTopx"

RadioButtonList

解决方案

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

其中div#radios包含您所有的无线电输入.我假设ddlBuyer是被点击的事物的ID.

由于我们不知道#radTopx是什么,所以我们无法给出答案.

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

解决方案

$('#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.

这篇关于使用jQuery取消选中单选按钮列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆