我试图找出如何使用jQuery获取每行的表格单元格的值.
我的表看起来像这样:
<table id="mytable">
<tr>
<th>Customer Id</th>
<th>Result</th>
</tr>
<tr>
<td>123</td>
<td></td>
</tr>
<tr>
<td>456</td>
<td></td>
</tr>
<tr>
<td>789</td>
<td></td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
我基本上想循环遍历表,并获取Customer Id每行的列值.
在下面的代码中,我已经知道我需要这样做才能让它循环遍历每一行,但我不知道如何获取行中第一个单元格的值.
$('#mytable tr').each(function() {
var cutomerId =
}
Run Code Online (Sandbox Code Playgroud) jquery ×1