如何添加时间来显示输入按钮

时间:2023-01-27 13:36:55

I made a login page and when you click on login it displays the progress. That's exactly what I want but sometimes it takes too much time to respond and login so I made a button to go back but it is displayed immediately when the progress is loading.

我创建了一个登录页面,当您单击登录时,它会显示进度。这正是我想要的,但有时需要花费太多时间来回复和登录,所以我做了一个按钮返回但是在加载进度时会立即显示。

I want it to be displayed after 10 seconds - not immediately .

我想让它在10秒后显示 - 而不是立即显示。

2 个解决方案

#1


2  

Use setTimeout function:

使用setTimeout函数:

setTimeout(function() { /*code here*/ }, 10000 /*time in milliseconds*/ );

Read more about it @ setTimeout : MDN

阅读更多相关信息@ setTimeout:MDN

As a side note I recommended pure js because jQuery increases load on the server

作为旁注,我建议使用纯js,因为jQuery会增加服务器的负载

#2


1  

You can try delay function

你可以尝试延迟功能

$('#button_id').delay(5000).fadeIn(10000);

And if you dont want jquery:

如果你不想要jquery:

setTimeout(function() {  Yourcode here }, 10000 //time(milliseconds) );

#1


2  

Use setTimeout function:

使用setTimeout函数:

setTimeout(function() { /*code here*/ }, 10000 /*time in milliseconds*/ );

Read more about it @ setTimeout : MDN

阅读更多相关信息@ setTimeout:MDN

As a side note I recommended pure js because jQuery increases load on the server

作为旁注,我建议使用纯js,因为jQuery会增加服务器的负载

#2


1  

You can try delay function

你可以尝试延迟功能

$('#button_id').delay(5000).fadeIn(10000);

And if you dont want jquery:

如果你不想要jquery:

setTimeout(function() {  Yourcode here }, 10000 //time(milliseconds) );