jQuery:$是未定义 [英] jquery: $ is undefined
本文介绍了jQuery:$是未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我经营着一个wordpress博客. 它包括Jquery
I run a wordpress blog. It includes Jquery
<script type='text/javascript' src='/wp-includes/js/jquery/jquery.js?ver=1.12.3'></script>
<script type='text/javascript' src=/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.0'></script>
当我运行jQuery
我知道了:
function (a,b){return new n.fn.init(a,b)}
当我尝试
$("div")
我知道了
未捕获的TypeError:$不是函数(…)
Uncaught TypeError: $ is not a function(…)
当我尝试jQuery("div")
我知道了:
a.fn.init [203]
a.fn.init[203]
如何使用Jquery?
How can I use Jquery ?
推荐答案
$
是jQuery()
函数的别名,在这种情况下显然不存在...
$
is an alias of the jQuery()
function, which apparently missing in this case...
一种方法是在jQuery和其他脚本之间进行操作:
One way is to do, between jQuery and your other scripts:
<script type="text/javascript">
var $ = jQuery;
</script>
应该可以
这篇关于jQuery:$是未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文