Prev Demo
Alerting The User After Two Seconds Of Onclick In Javascript
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Alerting user after 2 seconds of onclick.</h1> <p>Alert the user for after 2 seconds with an alert "WARNING!"</p> <input type="button" value="Alert" onclick="myAlert()"/> <script> function myAlert() { setTimeout(function() { alert("WARNING!"); },2000); } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output