var div = $('<div/>').text('inner text');
I want the full html of the div element including the element itself, not just the text inside it.
How can I do that?
div.get(0) // gives me an HTML Element Object, which I'm not sure what to do with.
get(0) will give you an object, use outerHTML property on it.
get(0)
outerHTML
div.get(0).outerHTML
or
div.prop('outerHTML')
var div = $('<div/>').text('inner text'); alert(div.get(0).outerHTML)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>