This article introduces the plug-in jquery. the confirm pop-up confirmation message implementation method. Interested partners can refer to this article to introduce the plug-in jquery. the implementation method of the confirm pop-up confirmation message 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:
Confirmation box message
Confirm Cancel
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.