jquery动态对table添加TD

来源:互联网 发布:mysql 工具 安卓 编辑:程序博客网 时间:2024/05/03 14:35

为table动态添加TD

<table id="_table">

<tr>

<td>标题</td>

<td>内容<td>

<tr>

</table>

现在为此table动态添加td

$("#_table tr").each(function(){

    $(this).children.eq($(this).children.length-1).after("<td>作者</td>");

});

为此table动态添加行

$("#_table").append("<tr><td>瓦良格号</td><td>航母</td></tr>");

动态删除此table的td

删除内容TD

$("#_table tr").each(function(){

    $(this).children.eq(1).hide();

});

显示内容TD

$("#_table tr").each(function(){

    $(this).children.eq(1).show();

});



原创粉丝点击