我有一个动态创建的表:
<div id="gameListDiv">
<table id="gameListTable">
<tr id="1">
<td>A</td>
<td>B</td>
<td class="tpButton">C</td>
</tr>
<tr id="2">
<td>D</td>
<td>E</td>
<td class="tpButton">F</td>
</tr>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
我有一个听众:
$('#gameListDiv').on('click','.tpButton', function(toggleThisTP) {
// If user clicks C, return the row ID of '1'
// if user clicks F, return the row ID Of '2'
});
Run Code Online (Sandbox Code Playgroud)
与上面的代码注释一样,当用户单击表的第3列中的单元格时,如何获取特定行的ID标记的值?