我使用Codiqa设计了我的移动应用程序。所以所有的css和js都是从链接加载的。我不知道如何取消选中单选按钮列表中的所有单选按钮。我尝试了许多编码,但它对我不起作用。HTML:
<div data-role="fieldcontain" data-controltype="radiobuttons">
<fieldset data-role="controlgroup" data-type="vertical">
<legend>
Shift
</legend>
<input id="radio1" name="rbtnShift" value="1" data-theme="c" type="radio">
<label for="radio1">
AM
</label>
<input id="radio2" name="rbtnShift" value="2" data-theme="c" type="radio">
<label for="radio2">
PM
</label>
<input id="radio3" name="rbtnShift" value="3" data-theme="c" type="radio">
<label for="radio3">
Night
</label>
</fieldset>
</div>Jquery:
$("input:radio[name='rbtnShift']").each(function (i) {
this.checked = false;
});我试过上面的代码,但它对我不起作用。我当然遗漏了一些基本的东西,但我不知道问题出在哪里。
首先,我选择一个选项

点击按钮后,显示如下所示

发布于 2013-08-20 18:26:40
使用knockout.js,下面的代码用于取消选择列表中的所有单选按钮
$("input[type='radio']").checkboxradio();
$("input[name^='rbtnShift']").attr("checked", false).checkboxradio("refresh");使用下面的代码动态选择列表中的单选按钮,
$("input[type='radio']").checkboxradio();
$("input[name=rbtnShift][value=" + 1 + "]").prop('checked', true);
$("input[name^='rbtnShift']").attr("checked", true).checkboxradio("refresh");发布于 2013-08-15 12:45:35
你可以给他们一个classname,然后试试:
$('.classname').prop('checked', false);发布于 2013-08-15 12:49:17
你也可以试试这个;
$('input:radio[name="rbtnShift"]').removeAttr('checked');https://stackoverflow.com/questions/18246410
复制相似问题