gpt4 book ai didi

javascript - 停止函数 jquery 重复

转载 作者:行者123 更新时间:2023-11-30 08:06:16 25 4
gpt4 key购买 nike

如果 div html = Ready,我如何阻止函数重复,这是我的代码

  (function(){
var Load_Div_Error = $( ".Load_Div_Error" ).html();

if(Load_Div_Error == "Ready") {
$( "div.Load_Div_Error" ).text( "Test" );
}
setTimeout(arguments.callee, 2000);
})();

最佳答案

else block 添加到您的 if 中:

if(Load_Div_Error == "Ready") {
$( "div.Load_Div_Error" ).text( "Test" );
} else {
setTimeout(arguments.callee, 2000);
}

这是 setTimeout 只有当 Div content != Ready 时才会启动

关于javascript - 停止函数 jquery 重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17914001/

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