$ is not a function 已解决

网上查资料和不断尝试,终于找到原因了.

1)网上一种解释:

If you are trying to add your own jQuery code to WordPress, and have had the error “$ is not a function” show up on Firebug, here is the fix:

Convert all dollar signs ($) to ‘jQuery’

The dollar sign is reserved in WordPress for the Prototype library, which is why it errors out. For example, instead of:


1
2
3
$().ready( function () {
    $( "#select_me" ).show();
});

Change it to:

1
2
3
jQuery().ready( function () {
    jQuery( "#select_me" ).show();
});


2)按照上面该法没作用. Error msg 变成: jQuery(***).dialog is not a function.

一个下午的努力, 觉得可能是js冲突所致.  一行行删代码, 发现是下面一行. 原来不是方法冲突, 而是引用冲突吧?!

"<script src="<session:constant name='ContextPath'/>/js/jquery-1.8.5/js/jquery-1.4.2.min.js" type="text/javascript"></script>". 在内部Frame的jsp中, 这样一行删除就OK了. 可能是外部已经引用了, 删除后jQuery的方法都正常了.


  • 13
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 9
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值