我在控制台中收到以下错误消息:
这是来自这个网页:http://mylzh.net/isaacBingo.php?seed=2jrxjc
但是在原始页面上它有效:http://mylzh.net/bingo/bindingofisaac/index.html?seed=2jrxjc
最佳答案
是因为下面的代码
$("#bingo tr td:not(.bingo_select), #selected td").toggle(function () {
$(this).addClass("greensquare");
}, function () {
$(this).addClass("redsquare").removeClass("greensquare");
}, function () {
$(this).removeClass("redsquare");
});
这个版本.toggle()已在 jQuery 1.9 中删除.
在执行此代码时,jQuery 假定它是采用 3 个参数的版本,例如 .toggle( duration [, easing ] [, complete ] ) , 所以它将第二个参数(函数)视为 easing
值并像在内部一样使用它
return this.pos = b = this.options.duration ? o.easing[this.easing](a, this.options.duration * a, 0, 1, this.options.duration) : a, this.now = (this.end - this.start) * b + this.start, this.options.step && this.options.step.call(this.elem, this.now, this), c && c.set ? c.set(this) : Kb.propHooks._default.set(this), this
作为解决方案,请查看 toggleClick()插件
关于javascript - jQuery Uncaught TypeError 但在不同的页面上工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22418119/