$(document).ready(function() { $("#isalldebt").click(function() { if ($(this).attr("checked")) { // 全选 $("input[name='debt_type']").each(function(){ $(this).attr("checked", true); }); } else { // 取消全选 $("input[name='debt_type']").each(function(){ $(this).attr("checked", false); }); } }); }); =======================下面html代码 <input > <input > <input > <input type="checkbox" > <label for="isalldebt" onclick="isalldebt()" >全选</label>