SCRIPT438:对象不支持属性或方法“委托”

SCRIPT438: Object doesn't support property or method 'delegate'

本文关键字:方法 委托 属性 对象 不支持 SCRIPT438      更新时间:2023-09-26

它在chrome或Firefox上工作正常,但在ie8上不起作用

    a(".contextual-help-tabs").delegate("a","click focus",function(d){
    var c=a(this),b;
    d.preventDefault();
    if(c.is(".active a")){
        return false
        }
a(".contextual-help-tabs .active").removeClass("active");
c.parent("li").addClass("active");
b=a(c.attr("href"));
a(".help-tab-content").not(b).removeClass("active").hide();
b.addClass("active").show()
});

从文档中:

从jQuery 1.7开始,.delegate()已被.on()方法取代。

尽管.delegate仍然存在并且应该可以工作,但您应该改用.on

a(".contextual-help-tabs").on("click focus", "a", function(d) {
  ...
});