jQuery 获取选中行 th 和 td 的值 - 代码示例
You can use the following jQuery code to get the values of the selected rows' th and td elements:\n\n\n// Get the selected rows\nvar selectedRows = $('tbody.xjcpdg2').find('tr').has('input[type="checkbox"]:checked');\n\n// Loop through each selected row\nselectedRows.each(function() {\n var thValue = $(this).find('th').text();\n var tdValues = $(this).find('td').map(function() {\n return $(this).text();\n }).get();\n \n console.log('th value: ' + thValue);\n console.log('td values: ' + tdValues.join(', '));\n});\n\n\nThis code will log the values of the selected rows' th and td elements in the console. You can modify it to perform any other desired actions with the values.
原文地址: https://www.cveoy.top/t/topic/pDRV 著作权归作者所有。请勿转载和采集!