Added replaceElementWithHtml