Try iterating over each <input>
and setting it's value
attribute to it's DOM value before accessing the html.
jsFiddle: http://jsfiddle.net/AWK9S/3/
$('form input').each(function()
{
this.setAttribute('value',this.value);
if (this.checked)
this.setAttribute('checked', 'checked');
else
this.removeAttribute('checked');
});
$('form select').each(function()
{
var index = this.selectedIndex;
var i = 0;
$(this).children('option').each(function()
{
if (i++ != index)
this.removeAttribute('selected');
else
this.setAttribute('selected','selected');
});
});
$('form textarea').each(function()
{
$(this).html($(this).val());
});
jsFiddle: http://jsfiddle.net/AWK9S/3/