[英]Uncaught TypeError: Cannot call method 'show' of null
I am getting an :Uncaught TypeError: Cannot call method 'show' of null" error in a script which points out the error is somewhere in this area, see below: 我收到一个:Uncaught TypeError:无法在脚本中调用方法“显示为null的错误”错误,该错误指出此区域中的某处,请参见下文:
// Show the correct more view images and if there are moreviews displayed, display the more views title
if (selectedmoreview !== null && selectedmoreview !== undefined && howMany > 0) {
selectedmoreviewtitle.show();
selectedmoreview.invoke('show');
} else {
if(howMany > 0){ selectedmoreviewtitle.hide(); }
}
spConfig.configureElement(dropdownEl);
Can anyone help me sort this out and have my functionality working? 谁能帮我解决这个问题并使我的功能正常工作? Some expert advice would be truly appreciated
一些专家的建议将不胜感激
Per request: 每个请求:
As far as I can see (and I only looked quickly) you are trying this line of code: 据我所见(并且我只是很快看了一下),您正在尝试以下代码行:
selectedmoreviewtitle = $('moreviews-title');
in the colorselected.js on row 204. And there's no element with id or class named 'moreviews-title'. 在第204行的colorselected.js中 。没有ID或类名为“ moreviews-title”的元素。 So that's why it gets null.
这就是为什么它为空。
Further more, you'd probably want to use class selector '.moreviews-title'
or id selector '#moreviews-title'
. 此外,您可能希望使用类选择器
'.moreviews-title'
或ID选择器'#moreviews-title'
。
You check selectedmoreview
, but you try to call selectedmoreview
. title .show()
您检查
selectedmoreview
,但是尝试调用selectedmoreview title .show()
。 Since selectedmoreview
isn't null selectedmoreviewtitle
probably is. 由于
selectedmoreview
并非为null, selectedmoreviewtitle
可能是null。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.