jQuery实现CheckBox全选、全不选 var flag = $(this).attr("checked"); $("[name=subBox]:checkbox").each(function() { $(this).attr("checked", flag); })