我在试图解决这个问题时有点卡住了。我需要获取一些单元格的内容,然后更新此单元格的内部文本
例如,我需要在每一行中获取 class = 2 和 class = 4 的单元格的值,然后更新它们的内部文本
我试图通过这段代码来做到这一点:
$(element).each(function ()
{
// code code code
});
但这并不是我真正需要的东西,因为这段代码只是在每一行获取每个元素,但我需要一次在每一行获取一些元素
它应该看起来像:
- 得到行。
- 在当前行获取 class = 1 和 class = 2 的元素
- 将他们的内容发送到脚本
- 更新单元格内容
- 获取下一行
- ETC
这是示例表:
<table>
<tr>
<td class="1"> Cell One </td>
<td class="2"> Cell Two </td>
<td class="3"> Cell Three </td>
<td class="4"> Cell Four </td>
</tr>
<tr>
<td class="1"> Also one Cell One </td>
<td class="2"> Also one Cell Two </td>
<td class="3"> Also one Cell Three </td>
<td class="4"> Also one Cell Four </td>
</tr>
</table>
**
并且。.
**
我需要为表中的每一行发送 Ajax 查询,其中包含当前行 ajax.php?id=column1&val=column2 的 2 个单元格的内部文本