I want to append a span element after an input field but appending the span to the input field using appendChild()
is not working as I'd like. How can I append an inline element after another element in js?
Here's my code to create the span element
var span = document.createElement("span");
span.setAttribute("id", inputNameValues[i] + "-error");
var errorText = document.createTextNode("* " + inputLabels[i] + " must not be left blank");
span.appendChild(errorText);
input.appendChild(span);