js function generates a multi-checkbox group, but the text is not displayed.
< div id= "product-radio-wrapper" > < / div >
< script >
createCheckbox (document.getElementById ("product-radio-wrapper"), [" Mobile", "Notebook", "Smart Speaker"], "product");
function createCheckbox (id,arr,name) {
var len = arr.length,
i,
label;
for (i = 0 ;i < len;iPP) {
var cbox = document.createElement("input"),
label = document.createElement("label");
cbox.type = "checkbox";
cbox.value = arr[i];
cbox.name = name;
cbox.innerHTML = arr[i];
label.appendChild(cbox);
id.appendChild(label);
}
}
< / script >
is shown as follows: