checkbox表格全选

    xiaoxiao2021-04-16  36

    function checkAll(obj){ if(obj.checked){ $("table input[type=checkbox]").prop("checked",true); }else{ $("table input[type=checkbox]").removeAttr("checked"); } $("#table input:checkbox:gt(0)").each(function(){ //做需要的操作 checkThis(this); }) } function checkThis(obj){ var tr = obj.parentNode.parentNode; var tds = tr.cells; if(obj.checked){ }else{ } } <table id="table" cssClass="form-control" cellspacing="0" width="100%"> <thead> <tr> <td><input type="checkbox" onclick="checkAll(this)"/></td> <td>id</td> <td>姓名</td> <td>邮箱</td> <td>账号</td> </tr> </thead> <tbody> <tr> <td><input type="checkbox" onclick="checkAThis(this)"/></td> <td>id</td> <td>name</td> <td>email</td> <td>zhanghao</td> </tr> </tbody> </table>
    转载请注明原文地址: https://ju.6miu.com/read-672811.html

    最新回复(0)