add label for in name fieldset

This commit is contained in:
Arthur Lu 2023-01-08 21:28:35 -08:00
parent b572b79798
commit 80e259b4f7

View File

@ -46,12 +46,14 @@ function addMetaLine (fieldset, labelText, inputAttr) {
let label = document.createElement("label"); let label = document.createElement("label");
label.innerHTML = labelText; label.innerHTML = labelText;
label.htmlFor = labelText;
field.append(label); field.append(label);
let input = document.createElement("input"); let input = document.createElement("input");
for (let k in inputAttr) { for (let k in inputAttr) {
input.setAttribute(k, inputAttr[k]) input.setAttribute(k, inputAttr[k])
} }
input.id = labelText;
field.append(input); field.append(input);
} }