I\'m using jQuery to add/remove input fields.
-
var foo = {1: [1, 2, 3]};
localStorage.setItem('foo', JSON.stringify(foo));
var fooFromLS = JSON.parse(localStorage.getItem('foo'));
Try storing the element as a string. Here is a site that gives a nice implementation getting the outerHTML of an element. http://www.yelotofu.com/2008/08/jquery-outerhtml/
jQuery.fn.outerHTML = function(s) {
return (s) ? this.before(s).remove()
: jQuery("<p>").append(this.eq(0).clone()).html();
}
Store that string and then reinsert the element using the appropriate jQuery method.