One can replace an element with new element with replaceChild function. The next example shows how to replace an image with the image's alternative text.
var theImage, altText;
theImage = document.getElementById('annoyingsmily');
if (theImage) {
altText = document.createTextNode(theImage.alt);
theImage.parentNode.replaceChild(altText, theImage);
}