use innerHTML directly

This commit is contained in:
Arthur Lu 2022-12-19 18:21:48 -08:00
parent 3368305b9b
commit 86eadf1791

View File

@ -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);