Skip to content

Instantly share code, notes, and snippets.

@BaylorRae
Created August 31, 2012 21:51
Show Gist options
  • Save BaylorRae/3559658 to your computer and use it in GitHub Desktop.
Save BaylorRae/3559658 to your computer and use it in GitHub Desktop.
var $stuff = $('#stuff'),
temp_items = document.createDocumentFragment(),
temp_item = null;
$.each(('this is an array of things that will get added to $stuff').split(' '), function(i, item) {
temp_item = $('<li />', {
text: item
})[0];
temp_items.appendChild(temp_item);
});
$stuff.append(temp_items);
var $stuff = $('#stuff'),
temp_items = document.createDocumentFragment(),
temp_item = null,
items = ('this is an array of things that will get added to $stuff').split(' ');
for( var i = 0, len = items.length; i < len; i++ ) {
temp_item = $('<li />', {
text: items[i]
})[0];
temp_items.appendChild(temp_item);
}
$stuff.append(temp_items);
var $stuff = $('#stuff');
$.each(('this is an array of things that will get added to $stuff').split(' '), function(i, item) {
$('<li />', {
text: item
}).appendTo($stuff);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment