Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery append td

Tags:

jquery

jqgrid

I am trying to append a td after the 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?

like image 510
DG3 Avatar asked Aug 29 '26 18:08

DG3


2 Answers

Something like that should help hopefully:

$(function(){
    $("#list_toppager_center tr:first td:last").after("<td class='ui-paging-info'>Col</td>");
}); 
like image 56
Greg Avatar answered Aug 31 '26 17:08

Greg


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.

like image 43
toby Avatar answered Aug 31 '26 17:08

toby



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!