Is there a way to turn this into a for loop? I have to run this code 114 time and am looking for a way to simplify this. The numbers on the class name would be the variable. The next one would be .select3 etc...
$('.select2').click(function () {
if ($('.saved_list .thumb2').length == 0 && $('.saved > li').length < totalPic)
{
$(this).parent().clone().appendTo('.saved_list ul');
$('.saved .select2').replaceWith('<div class="remove2">Remove</div>');
$('.saved a').contents().unwrap();
} else {
alert ('You can only choose 3 paintings');
}
if ($('.saved_list li').has('.thumb2')) {
$(".select2 .img-swap").attr("src", "images/check_on.gif");
} else {
$(".select2 .img-swap").attr("src", "images/check_off.gif");
};
});