A confirm box is typically used when you need the user to verify or approve something.
When a confirm box appears, the user must click either “OK” or “Cancel” to continue.
Clicking “OK” returns true, while clicking “Cancel” returns false.
window.confirm(“sometext“); |
The confirm() method can be used without the window prefix.
if (confirm(“Press a button!”)) { txt = “You pressed OK!”; } else { txt = “You pressed Cancel!”; } |