jQuery:链接多个函数会给出Uncaught Typeerror

问题描述:

我正在尝试在我的脚本中链接多个函数调用,但我一直在未捕获TypeError:$(...)。tablesorter(...)。tablesorterPager不是函数每当我尝试在我的网页上获取它时。

I'm attempting to chain multiple function calls in my script, but I keep getting Uncaught TypeError: $(...).tablesorter(...).tablesorterPager is not a function whenever I try to get it on my webpage.

有问题的代码格式如下:

The code in question is formatted like this:

function InitializeTableSorter() {
    var pagerOptions = {
        //object definitions in here
    }; 

    $("#transaction").tablesorter({
        //function stuff in here    
    }).tablesorterPager(pagerOptions);
}

我正在使用 tableSorter 和 tablesorterPager 函数。

这里出了什么问题?我错过了什么吗?

What went wrong here? Did I miss anything?

假设您安装了相应的插件文件(如果订单有问题,请按适当的顺序)

Assuming you have the appropriate plugin files installed (in the appropriate order if order matters)


未捕获TypeError:$(...)。tablesorter(...)。tablesorterPager不是函数

Uncaught TypeError: $(...).tablesorter(...).tablesorterPager is not a function

通常在jQuery和其他库之间存在冲突时遇到。为了避免麻烦,请调用 $ .noConflict()并且在文档 ready $ c后不要忘记运行jQuery代码$ c>

is usually encountered when there are conflicts between jQuery and other libraries. To stay out of trouble, call $.noConflict() and don't forget to run your jQuery code after the document is ready

$.noConflict();
jQuery(document).ready(function($){
  function InitializeTableSorter() {
    var pagerOptions = {
        //object definitions in here
    }; 

    $("#transaction").tablesorter({
        //function stuff in here    
    }).tablesorterPager(pagerOptions);
  }
});