gpt4 book ai didi

javascript - Jquery 追加表

转载 作者:行者123 更新时间:2023-12-02 14:46:54 27 4
gpt4 key购买 nike

html 文件

<div id='tweetPost'>
<table id="example">
<thead>
<tr>
<th>No</th>
<th>FistName</th>
</tr>
</thead>

<tbody></tbody>

</table>
</div>

JavaScript

$("#tweetPost").append(<tr>); 

$("#tweetPost").append("<td>"+tweets.statuses[i].text + "<td/>");
$("#tweetPost").append("<td>"+tweets.statuses[i].created_at +"</td>");

$("#tweetPost").append(</tr>);

当我尝试运行上面的代码时,表格不会出现。

问题:如何在 tbody 中追加 td 行?

最佳答案

您应该尝试像这样定位您的表 ID 示例和 tbody:

$("#example tbody").append("<tr><td>text</td><td>created</td></tr>");

请参阅此链接以获取工作示例:append to example table

关于javascript - Jquery 追加表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36526573/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com