SyntaxFix
Write A Post
Hire A Developer
Questions
Here's your problem:
if(imgArray[i] == img)
You're comparing an array element to a DOM object.