JQueryui1.7dialog only one question can be displayed _ jquery

Source: Internet
Author: User
Previously, for the delete operation, we used the general "Confirm deletion" method written by the head. The Code is as follows:


// Display the 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 of each button can only display the dialog once. Speechless...
There is no explanation for viewing the official documentation. Google once found that in ui.1.7.1, dialog must be initialized first.
In document. ready (function (){
// Initialize dialog
})

The Code is as follows:


$ ("# Layout-confirm"). dialog ({
AutoOpen: false,
Modal: true,
Title: "delete"
});


Note the following points:
Because some dialog parameters are passed in variables, you must first append option and then open
Sample Code:

The Code is 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 ~~

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.