Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript $(…)。tablesorter不是函数_Javascript_Jquery_Wordpress - Fatal编程技术网

Javascript $(…)。tablesorter不是函数

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

我的插件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.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添加为依赖项。