jQuery:链接多个函数会给出Uncaught Typeerror [英] jQuery: Chaining multiple functions gives Uncaught Typeerror

查看:70
本文介绍了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

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);
  }
});

这篇关于jQuery:链接多个函数会给出Uncaught Typeerror的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆