//全選與取消 $(function () { $("table :checkbox:first").change(function(){ $(this).closest("table") .find(":checkbox:not(:first)") .prop("checked", this.checked); }); })