我不能用jquery mobile以编程方式检查一组复选框,我有以下代码:
<div data-role="fieldcontain" id="div_radio" class="radiogroup">
<fieldset data-role="controlgroup">
<input type="radio" name="radio-pieces" id="radio-choice-1" value="3" checked="checked" />
<label for="radio-choice-1">1 to 3</label>
<input type="radio" name="radio-pieces" id="radio-choice-2" value="5" />
<label for="radio-choice-2">4 to 5</label>
<input type="radio" name="radio-pieces" id="radio-choice-3" value="6" />
<label for="radio-choice-3">over 5</label>
</fieldset>
</div>如果我这样做了:$("input[type='radio']:last").attr("checked",true).checkboxradio("refresh");所有的工作都很完美,但这些工作都没有:
$("input[type='radio']:first").attr("checked",true).checkboxradio("refresh");
$("input[type='radio']:eq(0)").attr("checked",true).checkboxradio("refresh");
$("input[type='radio']:eq(1)").attr("checked",true).checkboxradio("refresh");
$("input[type='radio']:eq(2)").attr("checked",true).checkboxradio("refresh");我如何正确地操作这些元素?取消选中所有复选框也很有效:
$("input[type='radio']").attr("checked",false).checkboxradio("refresh");似乎只有最后一个复选框起作用了。
发布于 2013-01-19 11:34:35
它们都工作得很好。您只需要在群中的所有input radio上触发refresh即可。
$("input[type='radio']:first").attr("checked", "checked");
$("input[type='radio']").checkboxradio("refresh");jsFiddle是here。
发布于 2014-06-30 05:40:19
对我来说什么都不是,除了:
$('#reset').click(function(){
$('#Store').trigger("click").trigger("click"); // yes... twice
});在jQuery手机1.4.2上。
发布于 2015-05-24 21:57:32
对我来说,这样做是为了取消选中整个组的无线电:
$(".my_class").removeAttr("checked");
$(".my_class").checkboxradio("refresh");https://stackoverflow.com/questions/14409571
复制相似问题