I have a for loop statement that doesn't loop, here's my code:
$(document).ready(function(){
    for(var i=1;i<=30;i++){
        $('img[alt="sample'+i+'"]').click(function(){
            var changeImage = $('img[alt="sample'+i+'"]').attr('src');
            var changeText = $('img[alt="sample'+i+'"]').attr('alt');
            $('img[alt="main image"]').attr('src', changeImage);
            $('h4#imageTitleHead').text(changeText);
        });
    }
});
the i won't loop and when I check the source code the code is still the same.. like this $('img[alt="sample'+i+'"]') it didn't change to number and did not loop at all.. Please help.. Thank you in advance
 
     
     
     
    