Add new td to tr jquery

You can add a new <td> element to a <tr> element using jQuery by using the .append() or .appendTo() method.

Here is an example:

$('tr').append('<td>New cell</td>');

This will add a new <td> element with the text "New cell" to the end of each <tr> element on the page.

If you want to add the new <td> element to a specific <tr> element, you can use the .append() method with a selector that targets the specific <tr> element:

$('#myTable tr:eq(1)').append('<td>New cell</td>');

This will add a new <td> element to the second <tr> element in the table with the id "myTable".

Alternatively, you can use the .appendTo() method to add the new <td> element to a specific <tr> element:

$('#myTable tr:eq(1)').append('<td>New cell</td>');

This will achieve the same result as the previous example.

You can also use the .after() method to add the new <td> element after a specific <td> element:

$('#myTable tr:eq(1) td:eq(1)').after('<td>New cell</td>');

This will add a new <td> element after the second <td> element in the second <tr> element in the table with the id "myTable".

Note that the .append() and .appendTo() methods will add the new element as a child of the specified element, while the .after() method will add the new element as a sibling of the specified element.