I'm have a for loop on jQuery and I want my counter to add a class each time with the number of the array it's coming from. But if I write:.addClass("delay"+counter++) that obviously won't work. Would there be another way of going about this.
For example this is what I have so far
$(document).ready(function() {
var counter = 1;
$.getJSON('http://www.passionla.com/app/blog-data.php', function(data) {
$.each(data, function(key, value) {
$('.blog').append("<div class='post animated slideInRight "+ counter++ +"' style=\"background:url('"+value.header+"') no-repeat; background-size: 100% 100%\"><div class='color'><div class='wrapper'><h1>"+value.title+"</h1></div></div></div>");
});
});
});
.addClasstypo*.addClass("delay"+ ( counter++ ) )