獲取table中CheckBox選中行的id


方式一

 

var selectList='';

jQuery(".table tbody input[type=checkbox]:checked").map(function () {

var id = jQuery.trim(jQuery(this).closest("tr").find("td:eq(0)").text());
 selectList+=id+',';

})

selectList=selectList.substring(0,selectList.length-1);

此方式的第一列是ID列

方式二

 

var selectList = jQuery(".table tbody input[type=checkbox]:checked").map(function () {

return jQuery(this).val();

}).get().join(',');

此方式需要將ID值作為CheckBox的value值

好處是不需要手動將每一個ID值加到字符串中

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM