speeddisaster
New Member
So I have fetched and parsed some data and I am using 'each' to display it:\[code\]$.ajax({ url : 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent('http://news.google.com/news?pz=1&cf=all&ned=uk&hl=en&output=rss'), dataType : 'json', success : function (data) { if (data.responseData.feed && data.responseData.feed.entries) { $.each(data.responseData.feed.entries, function (i, e) { $('.row').append("<div class=\"threecol\"">title: " + e.title + "<br></div>"); }); } }});\[/code\]And for the grid to function properly it needs to follow this structure:\[code\]<div class="container"> <div class="row"> <div class="threecol"> </div> <div class="threecol"> </div> <div class="threecol"> </div> <div class="threecol last"> </div> </div></div>\[/code\]So my question is, how would I sort through the each statement and place every 4 items into a new row and make every 4th item have the class "threecol last" instead of "threecol"?