var node = document.getElementById("portlet"), newNode = document.createElement("li"); while (node.firstChild) { newNode.appendChild(node.firstChild); } node.parentNode.replaceChild(newNode, node); newNode.id = node.id;