Jquery get values of all checked rows in table gridview

后端 未结 5 1246
慢半拍i
慢半拍i 2020-12-15 13:53

I have a table like below


<         
5条回答
  •  一整个雨季
    2020-12-15 14:49

    I want to retrieve (using jquery) a javascript array of all checked ID's in the table.

    Try:

    var ids = $("#mytable tr:has(input:checked)").map(function() {
       var $tr = $(this);
       var id = $tr.find("td:last").text();
       return id;
    }).toArray();
    
    alert(ids.join(", "));
    

提交回复
热议问题
checkedidtext