document.getElementById('addplace').addEventListener('click', function() {
addplace();
});
function addplace () {
var node = document.createElement("li"); // Create a <li> node
var textnode = document.createTextNode("<b>Waypoint</b>"); // Create a text node
node.appendChild(textnode); // Append the text to <li>
document.getElementById("waypoints").appendChild(node);
}
<input type="submit" id="addplace" value="Add One!">
<ul id="waypoints">
</ul>
I need this to make the html code work in each new li. I tried ierHTML as well and was only able to add plain text. How to make "Waypoint" bold instead of it showing the text "Waypoint"?
It's specifically for adding a new Google Places autocomplete field and an image of an "x" to delete the li so i'm looking for a solution that can pass values / be JavaScript friendly for the rest of my application mentioned in this question.
Thanks
