layui中checkbox组件,怎么判断是否为checked?判断都勾选了哪个?下面的console.log("周一已经选中"),不输出啊?
<form class="layui-form" action="">
<div class="layui-form-item" id="week" style="height:46px">
<!-- <label class="layui-form-label">原始复选框</label> -->
<div class="layui-input-block" id="week1">
<!-- 默认选择添加 checked="" -->
<input type="checkbox" name="monday" class="week" id="monday" value="monday" lay-skin="primary" title="周一" lay-filter="week">
<input type="checkbox" name="trusday" class="week" id="trusday" value="trusday" lay-skin="primary" title="周二" lay-filter="week">
<input type="checkbox" name="wednesday" class="week" id="wednesday" value="wednesday" lay-skin="primary" title="周三" lay-filter="week">
<input type="checkbox" name="thursday" class="week" id="thursday" value="thursday" lay-skin="primary" title="周四" lay-filter="week">
<input type="checkbox" name="friday" class="week" id="friday" value="friday" lay-skin="primary" title="周五" lay-filter="week">
<input type="checkbox" name="saturday" class="week" id="saturday" value="saturday" lay-skin="primary" title="周六" lay-filter="week">
<input type="checkbox" name="sunday" class="week" id="sunday" value="sunday" lay-skin="primary" title="周日" lay-filter="week">
</div>
</div>
</form>
layui.form.on('checkbox(week)', function (data) {
if($('#monday').attr("checked") === "checked"){
console.log("周一已经选中")
}
})