Is there any of when a user enters a page, Javascript wait 20 seconds and after waiting those 20 seconds show a real-time Submit?
To perform a function after a certain time, use the function .setTimeout(callback, delay)
.
It is important to pay attention to the fact that the parameter delay is represented in milliseconds as described below:
delay is the number of milliseconds (thousandths of a Second) that the Function call should be delayed by. If omitted, it defaults to 0. The actual delay may be longer; see Notes Below.
Let’s assume you have a function with the name minhaFuncao
, and want to run it after 20 seconds. In this case you would use the following syntax:
setTimeout(minhaFuncao, 20000);
Example
function showSubmit() {
document.getElementById('submit-btn').style.display = 'block';
}
setTimeout(showSubmit, 2000);
#submit-btn {
display: none;
}
<input type="submit" id="submit-btn">
Leave a button type Submit Hidden and use the Javascript settimeinterval function by spending time in ms to remove the Hidden from the button
– Gabriel Rodrigues
If the answer solved the problem, mark it as accepted. See http://meta.pt.stackoverflow.com/questions/1078/como-e-por-que-aceitar-uma-resposta/1079#1079
– David Schrammel