document.getElementsByClassName('class').outerHTML = "<div class='class'>some text</div>";