#

//获取选中项
$('#submit').click(function () {
    var check_list = []
    $("input[name='ck']:checked").each(function () {
        check_list.push(this.value);
    });
    alert(check_list.join(","));
});

//全选/取消全选
$('#all').toggle(function () {
    $("input[name='ck']").attr("checked", 'true');
}, function () {
    $("input[name='ck']").removeAttr("checked");
});


//反选
$('#unselected').click(function () {
    $("input[name='ck']").each(function () {
        if ($(this).attr("checked")) {
            $(this).removeAttr("checked");
        } else {
            $(this).attr("checked", 'true');
        }
    });
});

#

相关文章:

  • 2021-11-27
  • 2021-12-16
  • 2021-08-14
  • 2022-02-11
  • 2022-01-02
  • 2021-12-16
  • 2022-01-02
猜你喜欢
  • 2021-08-14
  • 2022-01-10
  • 2022-01-02
  • 2022-01-02
相关资源
相似解决方案