This code:
$.each(variant['photos'], function( index, object ) {
object['idx'] = index;
if(index == 0) object['active'] = true;
});
produces following error:
error Uncaught TypeError: Cannot read property 'photos' of undefined
Well, that error message is pretty self explanatory. You are attempting to read a property of something that isn't defined. In this case, the error comes from variant['photos']
. You haven't defined variant
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.