错误jQuery(domChunk)。live不是函数

错误jQuery(domChunk)。live不是函数,jquery,Jquery,错误:jQuery(domChunk).live不是函数源文件: http:///wp-includes/js/thickbox/thickbox.js?ver=3.1-20110528 第26行 这就是功能: //add thickbox to href & area elements that have a class of .thickbox function tb_init(domChunk){ jQuery(domChunk).live('click', tb_clic

错误:jQuery(domChunk).live不是函数源文件: http:///wp-includes/js/thickbox/thickbox.js?ver=3.1-20110528 第26行

这就是功能:

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
    jQuery(domChunk).live('click', tb_click);
}
使用jQuery版本1.6.1。
有什么办法可以避免这个错误吗?

我使用了jQuery(domChunk)。改为绑定来修复thickbox.js,用下面的函数替换tb_init()函数-这将支持所有版本的jQuery!它检查on()函数是否存在,如果不存在,它将退回到live()


听起来你传递的“domChunk”不是“domChunk”。根据firebug,传递的“domChunk”是“a.thickbox,area.thickbox,input.thickbox”。它显示为版本1.2.6,看起来相当旧。上面文件夹中的版本(wp includes/js/jquery)是1.6.1
function tb_init(domChunk){
    if($.isFunction($domChunk).on))
    {
        $(domChunk).on('click', domChunk, function(){
            var t = this.title || this.name || null;
            var a = this.href || this.alt;
            var g = this.rel || false;
            tb_show(t,a,g);
            this.blur();
            return false;
        });
    }
    else
    {
        $(domChunk).live('click', function(){
            var t = this.title || this.name || null;
            var a = this.href || this.alt;
            var g = this.rel || false;
            tb_show(t,a,g);
            this.blur();
            return false;
        });
    }
}