summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2022-12-23 22:12:53 +0100
committerErich Eckner <git@eckner.net>2022-12-23 22:12:53 +0100
commit476325cffbcacf0812d43f92cd1f11c2e3859712 (patch)
tree0cdcbbc2a557baebe182a94fd73a38fa0435f24f
parentb036d575259e8a801645426b51a70349bc39217d (diff)
downloadwordle-frontend-476325cffbcacf0812d43f92cd1f11c2e3859712.tar.xz
improve behaviour of "backspace"
-rw-r--r--index.html8
1 files changed, 6 insertions, 2 deletions
diff --git a/index.html b/index.html
index a13e770..4ac437c 100644
--- a/index.html
+++ b/index.html
@@ -44,7 +44,7 @@
for (let i = 1; i <= 5; i++) {
table
.querySelector("#row_" + row_count)
- .innerHTML += "<td id=\"column_" + i + "\" style=\"" + cell_style + "\"></td>";
+ .innerHTML += "<td id=\"column_" + i + "\" style=\"" + cell_style + "\">&nbsp;</td>";
}
cursor_column = 1;
updateCursorDisplay();
@@ -77,7 +77,11 @@
let cursor_increment = 1;
table.removeAttribute('bgcolor');
if (key == '#backspace') {
- if (cursor_column > 1) {
+ if (cursor_column > 1 &&
+ table
+ .querySelector("#row_" + row_count)
+ .querySelector("#column_" + cursor_column)
+ .innerHTML == '&nbsp;') {
cursor_column--;
}
to_print = '&nbsp;';