簡體   English   中英

未捕獲的TypeError:無法調用null的方法“ show”

[英]Uncaught TypeError: Cannot call method 'show' of null

我收到一個: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);

誰能幫我解決這個問題並使我的功能正常工作? 一些專家的建議將不勝感激

每個請求:

據我所見(並且我只是很快看了一下),您正在嘗試以下代碼行:

selectedmoreviewtitle = $('moreviews-title'); 

在第204行的colorselected.js中 。沒有ID或類名為“ moreviews-title”的元素。 這就是為什么它為空。

此外,您可能希望使用類選擇器'.moreviews-title'或ID選擇器'#moreviews-title'

您檢查selectedmoreview ,但是嘗試調用selectedmoreview title .show() 由於selectedmoreview並非為null, selectedmoreviewtitle可能是null。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM