From 5cd12d608115e8edf7401bd098584a7407e60e63 Mon Sep 17 00:00:00 2001 From: trinkey <97406176+trinkey@users.noreply.github.com> Date: Tue, 20 Feb 2024 16:21:23 -0500 Subject: [PATCH] fix adding inputs when none are left --- public/js/editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/editor.js b/public/js/editor.js index 248a4c8..6055fe5 100644 --- a/public/js/editor.js +++ b/public/js/editor.js @@ -36,7 +36,7 @@ function add_input(key) { let x = document.createElement("div") let q = [...document.querySelectorAll(`#${key} div[id^="${key}-"]`)]; - let i = Number(q[q.length - 1].dataset.id) + 1; + let i = Number(q[q.length - 1] ? q[q.length - 1].dataset.id : "-1") + 1; x.id = `${key}-${i}`; x.setAttribute("data-id", i);