i was sorta able to find a solution, but its not the cleanest code, and requires two loops… any chance someone here could refactor it for me?
function grabElements(){
$.each( $('.slidergrid'), function(i, left) {
$('.wf-span-3', left).each(function() {
var content = $(this).html();
$('#slider').append('<div class="slideshow_item" >'+content+'</div>');
});
})
}
function wrapElements(){
var divs = $("#slider > .slideshow_item");
for(var i = 0; i < divs.length; i+=2) {
divs.slice(i, i+2).wrapAll("<div style='width:23%; padding:1%; float:left;'></div>");
}
}
$.when($.ajax(grabElements())).then(function () {
wrapElements()
});