说明
详见:
https://www.runoob.com/jquery/jquery-dom-add.html
https://www.w3school.com.cn/jquery/jquery_dom_add.asp
案例
动态给table添加行
html:
<input type="button" id="add" value="添加一行" />
<table>
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
<th>性别</th>
</tr>
</thead>
<tbody id="tbData">
<tr>
<td>李雷</td>
<td>20</td>
<td>男</td>
</tr>
</tbody>
</table>
js:
<script type="text/javascript">
$("#add").click(function(){
var s = `
<tr>
<td>lucy</td>
<td>21</td>
<td>女</td>
</tr>
`
$("#tbData").append(s)
})
</script>