Home  >  Article  >  Web Front-end  >  Confirmer JQuery confirmation dialog component_jquery

Confirmer JQuery confirmation dialog component_jquery

WBOY
WBOYOriginal
2016-05-16 18:25:311365browse

Plug-in screenshot:

Confirmer JQuery confirmation dialog component_jquery

Purpose: To confirm whether to continue the current operation when clicking a link or button.

Plug-in code:

Copy code The code is as follows:

(function($){
$.fn.confirmer = function(options){
var defaults = {
msg:"Are you sure to delete it?"
}
var options = $.extend(defaults , options);
var control=$(this);
$(control).click(function(){return confirm(options.msg);});
};
}) (jQuery);

Usage:
1.$(".delete").confirmer();
2.$(".delete").confirmer({msg: 'Confirm deletion? '});
Example:
Copy code The code is as follows:




jquery.confirmer.js
< ;meta http-equiv="Content-Type" content="text/html; char set=utf-8" />





< ;button id="btnDelete" class="delete">Delete