javascript 未捕获的类型错误:未定义不是 Wordpress 中的函数(匿名函数)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24763256/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Uncaught TypeError: undefined is not a function (anonymous function) in Wordpress
提问by Mythbuster
I am getting the following error, which appears to be Javascript not interpreting the $ symbol.
我收到以下错误,这似乎是 Javascript 没有解释 $ 符号。
Uncaught TypeError: undefined is not a function main.js:1 (anonymous function) main.js:1
Uncaught TypeError: undefined is not a function main.js:1 (anonymous function) main.js:1
Appended below is the main.js code. This was working fine sometime back. I am trying to find out pointers to where to look for the issues, i.e. theme, jquery imports, etc. Any suggestions are welcome.
下面附加的是 main.js 代码。这在某个时候工作得很好。我试图找出指向何处查找问题的指针,即主题、jquery 导入等。欢迎提出任何建议。
$(function(){
var cardHeight = 0;
function _setCardHeight(){
$(".subpage-box").each( function(){ var current_height =
$(this).height();
cardHeight = ( current_height > cardHeight) ? current_height :
cardHeight;
}); $(".subpage-box").each( function(){ if( $(this).height() <
cardHeight ){ $(this).height( cardHeight ); } });
}
function _setNavStyle(){
$("menu-main-menu > li > a").each( function(){
var text = $(this).html();
if( $(this).contains("for") ){
}
});
}
_setNavStyle();
_setCardHeight();
});