javascript - if inside for loop not working for each iteration jQuery -


i want check condition given inside if statement not working. loop not iterating through array elements. giving first element of array. when remove if statement works fine. issue? below code:

$("label").click(function(){   var optionval = ($(this).attr('id'));   var arr = [];   var arra = [];   var = 0;    {% image in product.images %}      arr[i++] = ('{{ image.src | product_img_url: 'grande' }}');   {% endfor %}    (i = 0; < arr.length; i++) {     if (arr[i].match(optionval)) {       $(".product__slideshow-image").attr("src", arr[i]); // change image source                  alert(arr[i]);       }   } }); 


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -