In table
<table class="table table-striped table-hover universal" style="margin-bottom: 0px;">
<tbody>
<span id="appointment_info">
<tr>
<td>loading...</td>
</tr>
</span>
<tr>
<td>12:30 pm</td>
<td>Jenny Harris</td>
<td>Exam Room 1</td>
</tr>
</tbody>
</table>
I am replacing span id="appointment_info" using jQuery's .html() method.
Like below.
var html_str = "";
var apmts_len = apmts.length > 5 ? 5 : apmts.length;
for (var i = 0; i < apmts_len; ++i) {
html_str += "<tr> ";
var info = apmts[i];
for (var j = 0; j < 3; ++j) {
html_str = html_str + "<td>" + info[j] + "</td> ";
}
html_str += "</tr> ";
console.log(html_str); }
However, this failed. It prints everything in a row in one column, in an ugly format.
The generated html_str looks like <tr> <td>09:00 AM</td> <td>Richard Schwarm</td> <td>7</td> </tr>
How can I fix this?
tbodycan't havespanas its child