function insertElement(parent, tag, data) { tag = document.createElement(tag); content = document.createTextNode(data); tag.appendChild(content); parent.appendChild(tag); }