Home>Article>Web Front-end> What is the usage of confirm in javascript
In JavaScript, the confirm() method is used to display a specified message and a dialog box with confirmation and cancellation. The syntax is "confirm (text displayed on the dialog box)". When "OK" is clicked It will return true when the button is clicked, and false when the "Cancel" button is clicked.
The operating environment of this tutorial: Windows 10 system, JavaScript version 1.8.5, Dell G3 computer.
What is the usage of confirm in javascript
This method is a native method of JavaScript, used to display a specified message and confirm and cancel dialog box (the display mode is similar to the alert() effect). When the OK button is clicked (or the Enter key is clicked), true will be returned, and false will be returned when Cancel (or the ESC key) is clicked
Returns true after clicking OK (or pressing the Enter key)
Returns false after clicking Cancel (or the ESC key)
[Related recommendations:javascript learning tutorial]
The above is the detailed content of What is the usage of confirm in javascript. For more information, please follow other related articles on the PHP Chinese website!