Jquery get values of all checked rows in table gridview

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

I have a table like below


<         
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-15 14:26

    First of all add the id as the value parameter of the checkbox as an input without a value is of little real use:

checkedidtext
checkedid
123
456
789

Then in jQuery, create your array:

var checkedValues = $("input:checkbox:checked", "#mytable").map(function() {
    return $(this).val();
}).get();
alert(checkedValues.join(','));

Working fiddle

提交回复
热议问题