From ce1119f14a029f13382c3ec048a142a3062e16c9 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Mon, 19 Dec 2022 18:21:48 -0800 Subject: [PATCH] use innerHTML directly --- scripts/config.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/config.js b/scripts/config.js index 5d0a00f..1e643a5 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -14,17 +14,15 @@ async function populateForm (node, type, vmid) { let config = await request(`/nodes/${node}/${type}/${vmid}/config`); console.log(config); - addFormLine("cores", {label: "Cores:"}, {type: "number", value: config.data.cores, min: 1, max: 8192}); - addFormLine("memory", {label: "Memory"}, {type: "number", value: config.data.memory, min: 16}); + addFormLine("cores", "Cores", {type: "number", value: config.data.cores, min: 1, max: 8192}); + addFormLine("memory", "Memory", {type: "number", value: config.data.memory, min: 16}); } -function addFormLine (id, labelAttr, inputAttr) { +function addFormLine (id, labelName, inputAttr) { let labelWrapperDiv = document.createElement("div"); let label = document.createElement("label"); label.for = id; - for (let k in labelAttr) { - label.setAttribute(k, labelAttr[k]) - } + label.innerHTML = labelName; labelWrapperDiv.append(label); let labelContainer = document.querySelector("#labels"); labelContainer.append(labelWrapperDiv);