Tuesday, February 07, 2023

correct way to append with jquery

jquery append() actually appends an element. So, we need to make the append statement an entire row, in case we're appending to a table.

Populate html table on jQuery success event - Stack Overflow

table.append("<tr><td>"+elem.username+"</td><td>"+elem.name+"</td>   <td>"+elem.lastname+"</td></tr>");

and not something like

table.append("<tr><td>");
table.append(elem.username);
table.append("</td><td>");
etc.   

No comments:

Post a Comment