I'm trying to check all input boxes if there is an image tag next to it that contains a certain image location in it's src.
var productThumb = document.getElementsByTagName("img").src;
var inputs = document.getElementsByTagName("input");
for (var i = 0, max = inputs.length; i < max; i++) {
    imgSrc = productThumb[i];
    if (inputs[i].type === 'checkbox' && imgSrc.indexOf("/img/folder/1/") === 0 )
        inputs[i].checked = true;
}
When I run this code  I get the error in the title. What is wrong? I'm new to javascript so I have no idea what I am doing wrong but I think it has to be something with var = productThumb and imgSrc = productThumb[i]. What is the correct way of declaring the variables?
 
     
     
     
    