layui下的checkbox用js操作选中和取消选中

页面 

<input lay-skin="primary" type="checkbox" id="checkall" name="type" lay-filter="allChoose" value="checkall" title="全选" />

JS

//$("#checkall").removeAttr("checked");//无效
                            $("#checkall").prop("checked", false);//正确,取消选中
                         $("#checkall").prop("checked", true);//正确选中
                        form.render("checkbox");//重新渲染页面checkbox控件

 

posted @ 2022-03-23 08:45  离。  阅读(1637)  评论(0编辑  收藏  举报