我正在尝试这样做,
<table>
<tr id="ID1"><td></td></tr>
<tr id="ID2"><td></td></tr>
</table>
我需要像下面这样交换表行索引位置
<table>
<tr id="ID2"><td></td></tr>
<tr id="ID1"><td></td></tr>
</table>
我尝试使用 jQuery 修复它:
$('#ID1').after('#ID2');
谁能帮我用 javascript 解决上述问题?
$('#ID1').after('#ID2');
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table>
<tr id="ID1">
<td></td>
</tr>
<tr id="ID2">
<td></td>
</tr>
</table>
最佳答案
关于javascript - 使用javascript交换表行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26584555/