300js

首选区分一下prop与attr的差别。prop是固有属性,attr自定义属性。

    $("#all").click(function () {//全选、反选
            if(this.checked) {
                $("#dynamic-table tbody :checkbox").prop(\'checked\', true);
            } else {
                $("#dynamic-table tbody :checkbox").prop(\'checked\', false);
            }
        });
        $("#btn-to-report").click(function () {
            var list = [];
            $("#dynamic-table tbody :checkbox").each(function (i) {
                var _this = $(this);
                var checked = _this.prop(\'checked\');
                if(checked)
                    list[i] = _this.val();
            });
            var ids = list.join(\',\');
            alert(ids);
        });

 

分类:

技术点:

相关文章:

  • 2021-10-20
  • 2021-11-27
  • 2021-11-21
  • 2021-12-15
  • 2021-09-11
猜你喜欢
  • 2021-11-07
  • 2021-10-12
  • 2021-11-21
  • 2022-01-02
  • 2021-09-27
  • 2022-01-02
相关资源
相似解决方案