This article mainly introduces how confirm in js can pop up a confirmation box before executing the operation. It is a frequently used function for executing Delete and other operations and is of great practical value, for more information about how to use confirm in js, see the following example. Share it with you for your reference. The specific implementation method is as follows:
The confirmation prompt is displayed before deletion or other operations. We have many methods, the most basic of which is to use the confirm function provided by js to perform operations.
The simplest usage is as follows:
Use confirm for mouse events
The Code is as follows:
Click OK
You can also do this if you want to simply call it.
The Code is as follows:
Click OK
Click the hyperlink. If you click OK, the URL connected to the hyperlink is displayed. If you click Cancel, do not execute the hyperlink
Example.
The Code is as follows: