开发者

jquery append td

I am trying to append a td after th开发者_开发知识库e end of an existing td. Below is the following code (I am doing it in jqgrid).

$("#list_toppager_center tr:first td:eq(7)").append("<td class='ui-paging-info'>Col/td>");

I see that column gets added, but it gets added below the column I am trying to append to instead of adding beside. Is the above solution the right way to do it?


Something like that should help hopefully:

$(function(){
    $("#list_toppager_center tr:first td:last").after("<td class='ui-paging-info'>Col</td>");
}); 


You are missing a < on the closing </td>. I also think you want to select the row and append to that; you are adding a cell inside of a cell, which would make invalid HTML.


Tables have rows each with the same number of columns... You might add the append for each of the other rows (past row 1).

see: jQuery add HTML table column

$("#list_toppager_center tr:first").append("<td class='ui-paging-info'>New Col<td>");<br />
$("#list_toppager_center tr:gt(0)").append("<td> </td>");<br />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜