function makeTextNode(text) { return document.createTextNode(text); } function makeInput(type, id, value, label){ //type var newType = document.createElement(type); newType.setAttribute("for", type); if (id !== undefined && id != ""){ newType.setAttribute("id", id); newType.setAttribute("name", id); } newType.appendChild(makeTextNode(type)); return newType; //id var newId = document.createElement(id); if (id !== undefined && id != "") { newId.setAttribute("for", id); } newId.appendChild(makeTextNode(id)); return newId; //value var newValue = document.createElement(value); newValue.setAttribute("for", value); if (value !== undefined && value != "") { newValue.setAttribute("value", value); } newValue.appendChild(makeTextNode(value)); return newValue; //label var label = document.createElement("label"); if (id !== undefined && id != "") { label.setAttribute(makeLabel(label , id)); const div = document.createElement("div"); } //label.appendChild(makeTextNode(label)); //return label; div.appendChild(makeTextNode("label)); return div; } function makeLabel(label, id) { var newLabel = document.createElement("label"); if (id !== undefined && id != "") { newLabel.setAttribute("for", id); } newLabel.appendChild(makeTextNode(label)); return newLabel; }