diff options
author | Erich Eckner <git@eckner.net> | 2022-12-23 21:39:21 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2022-12-23 21:39:21 +0100 |
commit | e01d03ff45650c636460f10154c0d9a6ac61a629 (patch) | |
tree | df8e84c0aaee489ea23f02d13a2a88d3d0b29233 | |
parent | 356c1957aa44cf3a2166105bbd669dcfc9fcde47 (diff) | |
download | wordle-frontend-e01d03ff45650c636460f10154c0d9a6ac61a629.tar.xz |
only add rows to table, not additional tbodys
-rw-r--r-- | index.html | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -2,11 +2,10 @@ <html> <body> <h1>wordle</h1> -<table id="the_table"> -</table> +<table id="the_table"><tbody></tbody></table> <p id="debug"></p> <script> - let table = document.getElementById("the_table"); + let table = document.getElementById("the_table").getElementsByTagName("tbody")[0]; let row_count = 0; let cursor_column = 1; let puzzle = ''; @@ -40,9 +39,9 @@ } addNewRow = function() { row_count++; - the_table.innerHTML += "<tr id=\"row_" + row_count + "\" style=\"height:2em\"></td>"; + table.innerHTML += "<tr id=\"row_" + row_count + "\" style=\"height:2em\"></tr>"; for (let i = 1; i <= 5; i++) { - the_table + table .querySelector("#row_" + row_count) .innerHTML += "<td id=\"column_" + i + "\" style=\"" + cell_style + "\"></td>"; } |