How come this works:
var items = [];
$.each([1,2,3,4], function() {
items.push($('<li />').html('test' + this));
});
// clearing/appending as two seperate calls
$('ul').empty();
$(items).appendTo('ul');
but this doesn't?
var items = [];
$.each([1,2,3,4], function() {
items.push($('<li />').html('test' + this));
});
// clearing/appending in one fluent call
$('ul').empty().append($(items));
This way throws the following error:
No such interface supported.