Unchecking radiobutton list using jquery
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>
开发者_Python百科
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.
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.
$('#radTopx').prop('checked',false);
精彩评论