Jquery plug-in jquery. confirm pop-up confirmation message,

Source: Internet
Author: User

Jquery plug-in jquery. confirm pop-up confirmation message,

This article introduces the implementation method of the plug-in jquery. confirm pop-up confirmation message, which has some reference value. We will share it with you for your reference. The specific content is as follows:

Effect:

Code:

1. Default plug-in Parameters

// Default parameter $. confirm. defaults = {// style css: "http://static.qianduanblog.com/css/jquery.confirm/default.min.css? V = "+ Math. ceil (new Date ()/86400000), // the content of the confirmation box content:" OK? ", // Confirmation button text sureButton:" OK ", // cancel button text cancelButton:" cancel ", // position :{}, // autoOpen: false automatically opens, // animation duration: 123, // enable confirmation box callback onopen: emptyFn, // click confirm or cancel the callback onclick: emptyFn, // confirm the callback onsure: emptyFn, // cancel the callback oncancel: emptyFn, // close the confirmation box and callback onclose: emptyFn}

2. Plug-in structure and style
The dom structure of jquery. confirm is as follows:

<Div class = "jquery_confirm ____" style = "display: none "> <div class =" jquery_confirm ____ body "> confirmation box message </div> <div class =" jquery_confirm ____ footer "> <button class =" button-primary jquery_confirm ____ sure "> OK </button> <button class =" button-error jquery_confirm ____ cancel "> cancel </button> </div>

The default plug-in style is based on css.3. The default plug-in style address is default. The plug-in style is only rendered once and will not be rendered multiple times. The first time you use the plug-in style is used as the standard.

3. Usage

// Open the confirmation box $. confirm ({content: "Are you sure you want to view it? ", Onopen: function () {alert (" confirmation box opened! ") ;}, Onclose: function () {alert (" the confirmation box is closed! ") ;}, Onsure: function () {alert (" You clicked the OK button! ") ;}, Oncancel: function () {alert (" You have clicked the cancel button! ") ;}, Onclick: function (s) {if (s) {alert (" You clicked the OK button! ");} Else {alert (" You have clicked the cancel button! ") ;}}); $. Confirm (" OK? ", Function (s) {if (s) {alert (" You clicked the OK button! ");} Else {alert (" You have clicked the cancel button! ");}});

I hope this article will help you learn jquery programming.

Articles you may be interested in:
  • JQuery-based pop-up message plug-in DivAlert Tour (1)
  • The message box is displayed in the lower right corner of the message plug-in based on jQuery.
  • Use JQuery to create QQ pop-up messages conforming to Web standards
  • How does jquery determine the pop-up message when the browser returns?
  • Jquery creates a nice pop-up layer prompting message Effects

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.