gpt4 book ai didi

jquery - ajaxComplete 不适用于 $(window)

转载 作者:行者123 更新时间:2023-12-01 00:12:02 25 4
gpt4 key购买 nike

我使用的是 jQuery 版本 1.5.1,但这对我不起作用:

    $(window).ajaxComplete(function() {
console.log('hello');
});

但这是:

    $(document).ajaxComplete(function() {
console.log('hello');
});

为什么我无法将事件处理程序附加到 $(window)

注意:此代码适用于 jQuery v1.3.2,但不适用于 v1.5.1

最佳答案

可能是因为窗口

1.) Not an element

2.) Somewhat 'protected' by the browser's js engine

3.) a bad idea when looking for something to attach an AJAX event to

为什么不能使用 document 或元素来代替?

关于jquery - ajaxComplete 不适用于 $(window),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5504619/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com