1 <script src="js/plugin/jquery-1.9.0.js"></script>
? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 $(document).ready(function() { $("#selectAll").click(function() { $("input[name='subBox']").each(function() { this.checked = true; }); }); $("#reverse").click(function() { $("input[name='subBox']").each(function() { if (this.checked) { this.checked = false; } else { this.checked = true; } }); }); $("#checkItems").click(function() { $("input[name='subBox']").each(function() { if (this.checked) { this.checked = false; } else { this.checked = true; } }); }); });
? 1 2 3 <input type="checkbox" id="checkItems"> 全選 反選
? 1 2 <input type="checkbox" name="subBox" value="">