[英]setTimeout does not work when put in sequence
I think I made a small typo or something like that, because something clearly doesn't work as it should. 我想我做了一个小错字或类似的东西,因为有些东西显然不能正常工作。 I want to change the ID's of two different divs, in a sequence. 我想按顺序更改两个不同div的ID。
setTimeout(function() {$("#t1").attr('id','t1out')}, 4000)});
setTimeout(function() {$("#t2").attr('id','t1')}, 4500)});
Somehow, this manages to mess up the entire javascript, so nothing runs at all. 不知怎的,这设法弄乱了整个javascript,所以什么都没有运行。
Any idea what went wrong? 知道出了什么问题吗?
There are syntactical problems in the script . 脚本中存在语法问题。 There is an extra }
at the end of each statements. 每个陈述的末尾都有一个额外的}
。
setTimeout(function() {
console.log('1')
$("#t1").attr('id', 't1out')
}, 4000);
setTimeout(function() {
console.log('2')
$("#t2").attr('id', 't1')
}, 4500);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.