The getHTML() method of the Element interface is used to serialize an element's DOM to an HTML string.
getHTML()
MDN Reference