jquerymobile动态复选框

jquerymobile动态复选框,jquery,jquery-mobile,checkbox,Jquery,Jquery Mobile,Checkbox,我想让这个例子起作用 使用全选按钮 thx您应该使用此方法,而不是一种方法。这对您有用吗: JS HTML 测试 支付: 11 12 检查 只需这样做:- $('a[type=button]').click(function() { $('#checks input[type=checkbox]').attr('checked', 'checked').checkboxradio('refresh'); }); 在jquery mobile上,要选中复选框,需要使用chec

我想让这个例子起作用

使用全选按钮


thx

您应该使用此方法,而不是一种方法。

这对您有用吗:

JS

HTML


测试
支付:
11
12
检查
只需这样做:-

$('a[type=button]').click(function() {
    $('#checks  input[type=checkbox]').attr('checked', 'checked').checkboxradio('refresh');
});
在jquery mobile上,要选中复选框,需要使用
checkboxradio('refresh')

这就是诀窍,您需要按照此方法勾选复选框

请参阅

应使用.prop()方法来设置禁用和选中,而不是.attr()方法。
-from
<div data-role="page" id="Home">
    <div data-role="content">     
test
    <div id="checks" data-role="fieldcontain">
                     <fieldset data-role="controlgroup">
                        <legend>Pays:</legend>
                        <input type="checkbox" name="reg1" id="checkbox-1a" class="checkAllGroup"/>
                        <label for="checkbox-1a">11</label>

                        <input type="checkbox" name="reg2" id="checkbox-2a" class="checkAllGroup"/>
                        <label for="checkbox-2a">12</label>

                    </fieldset>
                </div>      

        <a type="button" id="checkAll">check</a>


    </div>

</div>
$('a[type=button]').click(function() {
    $('#checks  input[type=checkbox]').attr('checked', 'checked').checkboxradio('refresh');
});