Dynamically adding rows to table body [closed]

17 hours ago 1
ARTICLE AD BOX

The issue is a classic typo: you wrote texContent instead of textContent on those four lines. The browser doesn't throw an error because it just adds a custom property texContent to the cell object, which does nothing visible. It's one of those silent failures that drives you nuts.

Just change:

cell1.texContent = start_time; cell2.texContent = stop_time; cell3.texContent = name_of_band; cell4.texContent = name_of_bar;

to

cell1.textContent = start_time; cell2.textContent = stop_time; cell3.textContent = name_of_band; cell4.textContent = name_of_bar;

Also, insertRow() already adds the row to the tbody, so the tbody.appendChild(row) at the end is redundant, though harmless. You can drop it.

I've lost count of how many times a missing t in textContent has burned me. It's right up there with getElementById vs getElementByID and addEventListener vs addEventListner.

Read Entire Article