element.insertAdjacentHTML('beforeend', htmlString);
Where element
is a reference to a DOM element (e.g. returned from document.getElementById
).
Note: though element.innerHTML += htmlString
is also possible, it is usually a bad practice as all of the element's innerHTML
would be re-parsed into new DOM elements, trashing out the old elements and their attached listeners/data.