Use the confirmation box of JQuery boxy plug-in AspNet, jqueryboxy

Source: Internet
Author: User

Use the confirmation box of JQuery boxy plug-in AspNet, jqueryboxy

JQuery has many plug-ins in the pop-up box. boxy should be regarded as a good plug-in for both functions and effects. Let's take a look.

The Alert and Confirm pop-up boxes are often used in Web development. the delete button in. Net is often added with a confirmation prompt to avoid accidental deletion of data, as shown in the preceding figure. We usually write such code.

<Html xmlns = "http://www.w3.org/1999/xhtml"> 

The above code is very simple. The confirm pop-up box has two buttons. Click OK to return true, and then click Cancel to return false. The confirm method is also available in the boxy plug-in. The call code is as follows:

$ (Document). ready (function () {$ ("# btnDel"). click (function () {Boxy. confirm ("are you sure you want to delete it? ", Function () {}, null); return false ;});});

The confirm method of Boxy has three parameters: confirm the information content. In the pop-up box, click the correct callback function, and set items such as the title. If return false is not added to the above Code, the pop-up box will flash, and the acquired event of the delete button will still be executed. When return false is added, no background events will be executed whether you click OK or cancel the operation. This obviously does not meet our requirements. It seems that you can only call the callback function after you click OK. You can encapsulate Boxy confirm in a common js file:

The page call code is as follows:

$ (Document). ready (function () {$ ("# Button1"). click (function () {return confirmO (this, "Are you sure you want to delete it? ")});});

After this modification, the server event will be executed when you click the OK button in the pop-up box.

The above is all the content of this article. I hope you will like it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.