Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use confirm in jquery

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to use confirm in jquery". In daily operation, I believe many people have doubts about how to use confirm in jquery. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use confirm in jquery". Next, please follow the editor to study!

In jquery, confirm is used as "confirm (text displayed on the dialog box)"; the confirm () method is used to display a dialog box with the specified message and OK and cancel buttons, which returns true when the OK button is clicked, and false when the cancel button is clicked.

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 dialog box with the specified message and OK and cancel button.

The syntax is:

Confirm (message)

Message is used for plain text (instead of HTML text) displayed in a dialog box that pops up on window

If the user clicks the OK button, confirm () returns true. If you click the cancel button, confirm () returns false.

It blocks all 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 please write the question or message carefully so that it can be answered with confirmation and cancellation.

Examples are as follows:

Function show_confirm () {var r=confirm ("Press a button!"); if (r==true) {alert ("You pressed OK!");} else {alert ("You pressed Cancel!");}}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report