Converting element object to HTML string?

after i’ve built an element, can i convert that element to html?

the current method i’m thinking is to append this element to a new <Div> and call the Div’s innerHTML but it feels rather dirty. is there a better solution?

It’s not necessarily dirty. You don’t have to append the DIV to anything. You can also use a document fragment:

var frag = document.createDocumentFragment();
var html = frag.innerHTML;
delete frag; // if you're concerned about leaving things in memory

heys thanks for the reply. anyways i was wondering do we actually need to explicitly do the delete. is it fine not to include that statement?