Javascript $(…)。tablesorter不是函数
我的插件tablesorter有问题,显然我的系统没有识别现有的函数coo,不知道它是否与其他javascript有冲突(我正在wordpress插件中进行更改) 下面是我的代码:Javascript $(…)。tablesorter不是函数,javascript,jquery,wordpress,Javascript,Jquery,Wordpress,我的插件tablesorter有问题,显然我的系统没有识别现有的函数coo,不知道它是否与其他javascript有冲突(我正在wordpress插件中进行更改) 下面是我的代码: <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script> <script type="text/javascript" src="jquery.tablesorter
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="jquery.tablesorter.js"></script>
<script type="text/javascript">
(function($) {
$('table').tablesorter();
})(jQuery);
</script>
(函数($){
$('table').tablesorter();
})(jQuery);
我改变了调用js文件的方式
<?php
wp_register_script( 'jquery.tablesorter.js', get_bloginfo('template_url').'/js/jquery.tablesorter.js' );
wp_enqueue_script( 'jquery.tablesorter.js' );
?>
问题是提供下载文件的网站提供了一个与插件同名的插件,这让我很困惑,下载了错误的文件。你确定jquery.tablesorter.js的路径正确吗?@JayBlanchard是,我可以使用Browser的源代码访问.js,查看web开发者工具的网络选项卡,例如firebug。所有资源都正确加载了吗?@Simon Right,所有资源都加载了,jquery.tablesorter.js也加载了,但没有确定函数如何以及在何处插入js文件。加载tablesorter时,应该使用wp_enqueue_脚本并将jQuery添加为依赖项。