本次是以Jquery實現。
<inout name="checkeName" type="checkbox" value="abc"> </input>
// 獲取選中框的value
var abcs = [];
$('input :checkbox[name=checkName] : checked').each(function(){
abcs.push($(this).val());
// $(this).parents('tr').children().eq(1).html(); // 這個行代碼中數字 1 代表獲取復選框后的第一個td數據
});
checked :已選中
input :checkbox[name=checkName] : checked : 獲取已選中的name為:checkName的input標簽
$(this).val():獲取選中后的value
abcs.push():將獲取選中的數據以數組形式存入
// 獲取tr中某個td的數據
$(this).parents('tr').children().eq(1).html(); // 這個數字 1 代表獲取復選框后的第一個td數據