jQuery Table复选框选中获取元素值教程
"To get the selected checkbox values in the table using jQuery, you can use the following code:\n\njavascript\n// Get all the selected checkboxes in the table\nvar selectedCheckboxes = $("table input[type='checkbox']:checked");\n\n// Loop through each selected checkbox\nselectedCheckboxes.each(function() {\n // Get the corresponding table row\n var row = $(this).closest('tr');\n \n // Get the values of the columns in the row\n var attribute1 = row.find('td:nth-child(2)').text();\n var attribute2 = row.find('td:nth-child(3)').text();\n var attribute3 = row.find('td:nth-child(4)').text();\n \n // Do something with the values\n console.log("Attribute 1: " + attribute1);\n console.log("Attribute 2: " + attribute2);\n console.log("Attribute 3: " + attribute3);\n});\n\n\nThis code will get all the selected checkboxes in the table, and for each selected checkbox, it will find the corresponding table row and get the values of the columns in that row. You can then do whatever you want with those values.
原文地址: https://www.cveoy.top/t/topic/pA3d 著作权归作者所有。请勿转载和采集!