//注意這種方法錯誤,要用prop if($("#check_status").attr('checked')) //檢測checkbox狀態 { //checked狀態 }else { //不是checked狀態 } //正確 $("#check_all").bind('click',function(){ if($(this).prop('checked')){ alert("checked"); }else{ alert("no checked"); } });
input里面check 狀態檢測
<div class="item-input wy20-right">
<label class="label-switch">
<input type="checkbox" id="check_status">
<div class="checkbox"></div>
</label>
</div>
