You can render HTML using document.write()
document.write('<html><body><h2>HTML</h2></body></html>');
But to append existing HTML string, you need to get the id of the node/tag under which you want to insert your HTML string.
There are two ways by which you can possibly achieve this:
- Using DOM –
var tag_id = document.getElementById('tagid');
var newNode = document.createElement('p');
newNode.appendChild(document.createTextNode('html string'));
- Using innerHTML –
var tag_id = document.getElementById('tagid');
tag_id.innerHTML = 'HTML string';