Suppose I have two different tables as below:
<table id="T1">
<tr id="a">
<td>a</td>
</tr>
<tr id="b">
<td>b</td>
</tr>
</table>
<table id="T2">
<tr id="a">
<td>A</td>
</tr>
<tr id="b">
<td>B</td>
</tr>
</table>
These two tables have different IDs. However, due to design, some of their rows, when created, have the same IDs. In this case, both rows have the same ids a
and b
.
I am having trouble accessing rows by using document.getElementById
since it could be multiple duplication. How do I specify a row using both the table ID and the row ID in JavaScript? Thanks.
question from:
https://stackoverflow.com/questions/65884246/access-rows-from-different-tables-using-row-ids 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…