首页 > 代码库 > 复选框操作

复选框操作

<script>
    $(function () {
        //查找id=tab的表格,下面所有的tr,下面的所有td,第一个td下面复习框的点击事件。
        $("#tab tr>td:nth-child(1)").find("input[type=‘checkbox‘]").bind("click"function () {
            if ($(this).attr("checked") == true) {
                $(this).parent().nextAll().find("input[type=‘checkbox‘]").attr("checked"true);
            }
            else {
                $(this).parent().nextAll().find("input[type=‘checkbox‘]").attr("checked"false);
            }
        })
    })
</script>