简体   繁体   English

未捕获的TypeError:无法调用null的方法“ show”

[英]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.

相关问题 未捕获的TypeError:无法调用null的方法“ appendChild”? - Uncaught TypeError: Cannot call method 'appendChild' of null? 未被捕获的TypeError:无法调用null的方法'getElementsByTagName' - Uncaught TypeError: Cannot call method 'getElementsByTagName' of null 未捕获的TypeError:无法调用null的方法'replaceChild' - Uncaught TypeError: Cannot call method 'replaceChild' of null 未捕获的TypeError:无法调用null的方法“ menuAim” - Uncaught TypeError: Cannot call method 'menuAim' of null 未捕获的TypeError:无法调用null的方法'replace' - Uncaught TypeError: Cannot call method 'replace' of null 未捕获的TypeError:无法调用null的方法“ get” - Uncaught TypeError: Cannot call method 'get' of null 未捕获的TypeError:无法调用null的方法“提交” - Uncaught TypeError: Cannot call method 'submit' of null XML,JavaScript-未捕获的TypeError:无法调用方法'getElementsByTagName'为null - XML, Javascript - Uncaught TypeError: Cannot call method 'getElementsByTagName' of null 如何修复“Uncaught TypeError:无法调用方法'appendChild'的null” - How to fix “Uncaught TypeError: Cannot call method 'appendChild' of null” 未捕获的TypeError:无法调用null的方法“ terminate”(网络工作者) - Uncaught TypeError: Cannot call method 'terminate' of null (web worker)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM