Copy Code code as follows:
Show confirmation dialog box
function Showconfirm (Txttitle, Txtmsg, callback) {
Getdivdialog (). Text (TXTMSG). Dialog ({
Modal:true
, overlay: {
opacity:0.5
}
, Title:txttitle
, buttons: {
"Yes": function () {
Callback ();
$ (This). dialog ("Close");
}
, "No": function () {
$ (This). dialog ("Close");
}
}
});
}
However, when using ui.1.7.1, the Click event for each button can only be displayed once for dialog. No words ...
There is no explanation for viewing the official document. Google has found that in ui.1.7.1 dialog must first be initialized.
In Document.ready (function () {
Initialize dialog
})
Copy Code code as follows:
$ ("#layout-confirm"). Dialog ({
Autoopen:false,
Modal:true,
Title: "Delete"
});
In the later use, there is one thing to note:
Because some dialog parameters are passed in by the variable, you must first attach the option and then open
code example:
Copy Code code as follows:
Deltext.click (function () {
$ ("#layout-confirm"). Dialog (
' option '
, ' buttons '
,{
OK: function () {
if (File.type = = 0) {
DeleteFolder (File.path);
}
else{
DeleteFile (File.path);
}
}
, Cancel: function () {
$ (This). dialog ("Close");
}
}
);
$ ("#layout-confirm"). Dialog ("Open");
});
OK, fix it ~