Prev Demo
How To Show A Confirmation Box In Javasript?
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <script> function ConfirmMe() { var v = confirm('Are you sure to proceed?'); if (v) { // OK pressed; user confirmed to proceed further // write your code to execute code alert("Go ahead"); } else { // Cancel pressed; user do not want to proceed alert("Stop"); } } </script> <input type="button" id="btnTest" onclick="ConfirmMe()" value="Click me!" /> </body> </html>
Note: We DO NOT save your trial code in our database.
Output