下面是我的表结构,如何以下面的格式追加数据
在格式中
<tr> <td>zzz</td> <td> ppp </td> </tr>
<div id="users-contain" class="ui-widget">
    <table id="users" class="ui-widget ui-widget-content">
    <thead>
        <tr class="ui-widget-header ">
            <th>Name</th>
            <th>Email</th>
            <th>Password</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>fdgfdgfg</td>
            <td>avc@example.com</td>
            <td>vbvcbvb</td>
        </tr>
    </tbody>
</table>
</div>发布于 2012-02-29 22:00:45
您可以使用jQuery直接创建HTML元素:
$("<tr><td>MyName</td><td>my@email.com</td><td>myPassword</td></tr>").appendTo("#users tbody");
注意:在您的格式中,您遗漏了第三列:密码
发布于 2012-02-29 22:01:30
$('<tr> <td>zzz</td> <td> ppp </td> </tr>').appendTo('#users tbody');发布于 2012-02-29 22:03:25
这将向您的表中添加新行
$("#users tbody").append('<tr><td>name</td><td>email@domain.com</td><td>password</td></tr>');https://stackoverflow.com/questions/9500465
复制相似问题