Reputation: 27
How do I add a word in between two appendChild that are list items for example my code is the one below. This shows male 18, I want it to show male - age:18
x.appendChild (gender);
x.appendChild(age);
document.getElementById("list").appendChild(x);
Upvotes: 1
Views: 110
Reputation: 89264
You can use append
to add text nodes to an element.
x.appendChild (gender);
x.append(" - age:");
x.appendChild(age);
Upvotes: 2