Really dumb question but, for instance, given:
var $foo = $('<div>bar</div>');
How would I get the '<div>bar</div>' back out?
Really dumb question but, for instance, given:
var $foo = $('<div>bar</div>');
How would I get the '<div>bar</div>' back out?
You need to append it to a container, then call .html() on that.
This is because .html() only gives you the content.
Try it out: http://jsfiddle.net/ttYXG/
var $foo = $('<div>bar</div>');
$('<div />').append($foo).html();