jQuery: Get HTML as well as input values
You may also achieve this by first changing the value of input fields uding DOM like this:
$('div input').each(function(){
$(this).keyup(function(){
$(this).attr('value',$(this).val());
});
});
after which you can extract the HTML by using this:
$('div').html();
You could $.clone()
the element.
var $a = $("div:first").clone();
$a.appendTo("body"); // Clone invades your body
Online Demo: http://jsbin.com/obebov/edit