Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Shopify Variant Product-未捕获类型错误:无法读取属性';风格';空的_Javascript_Shopify_Variant_Error Code - Fatal编程技术网

Javascript Shopify Variant Product-未捕获类型错误:无法读取属性';风格';空的

Javascript Shopify Variant Product-未捕获类型错误:无法读取属性';风格';空的,javascript,shopify,variant,error-code,Javascript,Shopify,Variant,Error Code,我在一个Shopify网站上工作,试图关闭4个包的订阅选项 我有这个代码,但是我遇到了一个我不熟悉的错误。希望有人能给我指出正确的方向来解决。谢谢 网站: (密码:susahx) 错误: “未捕获的TypeError:无法读取null的属性'style'” 代码: /*====================================== 禁用4包订阅 ========================================= */ window.addEventListene

我在一个Shopify网站上工作,试图关闭4个包的订阅选项

我有这个代码,但是我遇到了一个我不熟悉的错误。希望有人能给我指出正确的方向来解决。谢谢

网站:密码:susahx)

错误: “未捕获的TypeError:无法读取null的属性'style'”

代码:

/*======================================
禁用4包订阅
========================================= */
window.addEventListener('DOMContentLoaded',(事件)=>{
让noSub='4块'
让variants=document.querySelectorAll(“[data value]”);
让表单=document.querySelector('.rc_container'))
让initialCheckedValue=document.querySelector('.swatch输入:选中')
//论变异
variants.forEach(variant=>
variant.addEventListener('click',e=>{
if(e.target.value==noSub){
//隐藏RC小部件并单击第一次/一次性选项
reserverform.style.display='none'
document.querySelector('.rc_widget_uuoption--onetime input')。单击();
}否则{
reserverform.style.display='block'
}
})
)
//首次装载
if(initialCheckedValue.value==noSub){
//隐藏RC小部件并单击第一次/一次性选项
reserverform.style.display='none'
document.querySelector('.rc_widget_uuoption--onetime input')。单击();
}否则{
reserverform.style.display='block'
}

});用document.getElementById(“DivID”)替换您的表单。注意:根据需要更新id


#迪维德{
宽度:250px;
高度:250px;
背景颜色:蓝色;
}
单击此处隐藏
单击后,此部分将隐藏
函数clickFunction(){
document.getElementById(“DivID”).style.display=“无”;
}

充值表单正在使用ShopifyScripts API,因此尚未在DOMContentLoaded上准备好。您需要查看是否存在充值用于通知表单已加载的全局事件,或者您可以使用“变异观察者”检查表单内容何时使用充值更新。