//全選 全不選 $('#checkAll').click(function () {        //判斷是否被選中        var bischecked = $('#checkAll').is(':checked');        var fruit = $('input[name="check"]');        bischecked ? fruit.attr('checked', true) : fruit.attr('checked', false);   });//反選   遍歷checkbox 如果當前為選中 就設置為 不選中 反之相同    $("#tabVouchList tr").each(function () {        if ($("td:eq(0) input[name='check']", $(this)).is(':checked')) {            $(this).attr('checked', false);        } else {            $(this).attr('checked', true);        }    });<table id="tabVouchList"> <tr> <th> <input type="checkbox" name="checkAll" /> </th> <th> 行號 </th> <th> 名稱 </th> </tr> <tr> <td> <input type="checkbox" name="check" /> </td> <td> 行號 </td> <td> 名稱 </td> </tr> </table>
新聞熱點
疑難解答