From 06aa9ac47e7ce84e085ffbee27135bb685cec69f Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Mon, 19 Dec 2022 18:12:39 -0800 Subject: [PATCH] use setAttribute --- scripts/config.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/config.js b/scripts/config.js index 6955642..ca0bd70 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -23,7 +23,8 @@ function addFormLine (id, labelAttr, inputAttr) { let label = document.createElement("label"); label.for = id; for (let k in labelAttr) { - label.k = labelAttr.k; + label.setAttribute(k, labelAttr[k]) + label[k] = labelAttr.k; } labelWrapperDiv.append(label); let labelContainer = document.querySelector("#labels"); @@ -34,7 +35,7 @@ function addFormLine (id, labelAttr, inputAttr) { input.id = id; input.name = id; for (let k in inputAttr) { - input.k = inputAttr.k; + input.setAttribute(k, inputAttr[k]) } inputWrapperDiv.append(input); let inputContainer = document.querySelector("#inputs");