Home>Article>Web Front-end> What is the usage of confirm in javascript

What is the usage of confirm in javascript

WBOY
WBOY Original
2021-12-28 19:04:51 10406browse

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.

What is the usage of confirm in javascript

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

 

What is the usage of confirm in javascript

Returns true after clicking OK (or pressing the Enter key)

What is the usage of confirm in javascript

Returns false after clicking Cancel (or the ESC key)

What is the usage of confirm in javascript

[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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn