What is the use of confirm in jquery

WBOY
Release: 2022-01-10 16:29:11
Original
7023 people have browsed it

In jquery, the usage method of confirm is "confirm (text displayed on the dialog box)"; the confirm() method is used to display a dialog box with a specified message and OK and Cancel buttons. It will return true when the "OK" button is clicked and false when the "Cancel" button is clicked.

What is the use of confirm in jquery

The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.

What is the use of confirm in jquery

The confirm() method is used to display a message with a specified message and OK and cancel buttons. dialog box.

The syntax is:

confirm(message)
Copy after login

message is used for plain text (not HTML text) displayed in the dialog box that pops up on the window

If the user clicks OK button, confirm() returns true. If the cancel button is clicked, confirm() returns false.

It will block all user input to the browser until the user clicks the OK button or the Cancel button to close the dialog box. When confirm() is called, execution of the JavaScript code is paused and the next statement is not executed until the user responds.

The text of the dialog button is immutable, so carefully write your question or message so that it is suitable for answering with confirm and cancel.

The example is as follows:

   
Copy after login

Output result:

Before clicking the button

What is the use of confirm in jquery

##Click After the button

What is the use of confirm in jquery

# Recommended related video tutorials:

jQuery video tutorial

The above is the detailed content of What is the use of confirm in jquery. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!