<table>中点击一行中任意列数据,则可以让<checkbox>选中或者取消选中。

来源:互联网 发布:能在mac上玩的网游 编辑:程序博客网 时间:2024/05/16 11:14
    $(function () {        $("#data_table tr:gt(0)").click(function () {             console.log($(this).find(":checkbox").prop("checked"))            if ($(this).find(":checkbox").prop("checked"))// 此处要用prop不能用attr,至于为什么你测试一下就知道了。            {                $(this).find(":checkbox").removeAttr("checked");                // $(this).find(":checkbox").attr("checked", 'false');             }            else            {                $(this).find(":checkbox").prop("checked", true);            }         });    })

0 0
原创粉丝点击