ok, so I am using jquery 1.5.2, jquery ui 1.8.12 and the jquery cookie plugin.
I am trying to save the order of a UL list into an array, which is then stored into a cookie. This works as expected. I am then also trying to repopulate the UL according to data found in the cookie on dom.ready. The part that is not working is the repopulation portion ( I will highlight in red)
tell me where I messed up please

. ( it seems like it doesnt like my appendTo for some reason)
jquery code
Code:
$(document).ready(function() {
$( "#nsmclist" ).sortable({
update: function(event, ui) {
var nsmclistordervar = $('#nsmclist').sortable('toArray');
$.cookie("nsmclistorder",nsmclistordervar);
//alert($.cookie('nsmclistorder'))
}
});
var foo = $("#nsmclist");
var order1 = $.cookie("nsmclistorder");
if (order1) {
$.each(order1.split(),function(i,id) {
//appending the element with the ID given id should move each element to the end of the
// list one after another, and at the end, the order should be restored.
$("#"+id).appendTo(foo);
});
}
});
markup:
Code:
<ul id="nsmclist">
<li id="nsmclist1">test1</a></li>
<li id="nsmclist2">test2</a></li>
<li id="nsmclist3">test3</a></li>
<li id="nsmclist4">test4</a></li>
</ul>