html
<div class="layui-input-inline">
<input type="checkbox" class="checkboxAll" lay-skin="primary" lay-filter="allChoose" title='全选'>
</div>
<input type="checkbox" name="check[]" value="{$item.id}" lay-skin="primary" title="{$item.type_name}" lay-filter="oneChoose">
<input type="button" id="sub" class="layui-btn" value="确认添加">
js
layui.use(['layer','form'], function () {
var form = layui.form
,layer = layui.layer; form.on('checkbox(allChoose)', function (data) {
$("input[name='check[]']").each(function () {
this.checked = data.elem.checked;
// console.log(data);
});
form.render('checkbox');
}); }); $('#sub').click(function(){
var items =[];
$("input[name='check[]']:checked").each(
function(){
items.push($(this).val());
})
console.log(items);
})