nickberens360
3/23/2017 - 2:35 PM

Loop through elements with incrementing class name

Loop through elements with incrementing class name

var i = 0;

$('.picBoxGrid').find('.picBox').each(function () {

    if (i < 4) {

        i++;

    }

    else {

        i = 1;

    }

    $(this).addClass('picBoxColor-' + i);

});