根据复选框checkbox的选中状态来打开或关闭隐藏层
HTML:
<input type="checkbox" >
<div >隐藏层</div>
JS:
$(function () {
if ($("#check-expert").attr("checked") == "checked") {
$("#expert").css('display', 'block');
}
$("#check-expert").on('click', function () {
if ($(this).is(':checked')) {
$("#expert").css('display', 'block');
} else {
$("#expert").css('display', 'none');
}
})
});