Skip to content
Advertisement

Uncaught TypeError: Cannot read property ‘substr’ of undefined

Pardon me for not being clear, but have thia script that is really long. When I have it live, I get this error in Chrome’s Console.

Uncaught TypeError: Cannot read property ‘substr’ of undefined

here is the snippet of code where it is reading from.

JavaScript

I looked up substr on google and it appears to be a known property. I also found the classes. I have played with the lengths, but still getting stuck. It used to work until BigCommerce did an update.

Any advice much appreciated, cheers.

Advertisement

Answer

You are not populating your array. The if check is false.

enter image description here

so basically you are doing this

JavaScript

which results in the error above.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement