I have an img element with “id=lastClone”
I take " TypeError: Cannot read property ‘id’ of undefined" error how can I fix it?
Hey Fatih,
means that id doesn’t exist on carouselImages[counter].
So what do you expect carouselImages[counter] to be?
Where does carouselImages come from?
What is carouselImages[counter] before the if?
Check your logic for setting counter. In at least one situation when the event listener is triggered carouselImages[counter] is not defined. If carouselImages is an array and counter is an integer, then you are probably running into an index out of bounds error.
