问题描述
我想选择第一个色板。为此,我正在做这样的事情。
var gallery = $('[data-gallery-role=gallery-placeholder]',$('.column.main'));
gallery.on('gallery:loaded',function () {
$('.swatch-attribute .swatch-attribute-options',context).each(function() {
$('.swatch-option:not(.disabled)',this).first().click();
});
});
但它正在抛出错误。我们使用的是 Magento 2.3.6。
解决方法
听起来页面上不存在元素 $('[data-gallery-role=gallery-placeholder]',$('.column.main'))
,因此元素未定义。