I have a unordered list in my html document where am trying to update each of the list elements of which there are five with text from an ajax request. Here is a snippet of my code:
var modify = document.getElementsByTagName('li');
var modifyText = document.createTextNode( request.responseText );
var modifiedElements = [].slice.call(modify);
modifiedElements.forEach(function(elem){
console.log(elem);
elem.appendChild(modifyText);
});
The problem i am having is that only the last list element is being updated. Why is that the case? Thank you.
elem.innerHTML = request.responseText;