【发布时间】:2012-03-30 18:54:31
【问题描述】:
我无法让一些 javascript 和 Jquery 延迟适当的时间。我想更改一些文本,等待 5 秒,然后弹出警报。
代码如下:
$('#result').html("Record has passed").delay(5000);
alert("Record has passed");
由于某种原因,警报在 jquery 更改#result 并等待之前运行。任何解决方案或其他人看到这个问题?
我试过了
setTimeout($('#result').html("Record has passed"), 5000);
也一样,但仍然没有运气。
【问题讨论】:
-
我还应该补充一点,我也尝试过移动 .delay(5000):$('#result').delay(5000).html("Record has passed");