2013-03-05 63 views
0

基本上我想在同一页面的任何地方都使用jQuery ui dialog,我怎么用这个?全球jQuery ui确认框

我写了下面的代码和我需要定制的东西都是需要看齐

$("#dialog-confirm").dialog({ 
       resizable: false, 
       height:140, 
       modal: true, 
       autoOpen: false, 
       buttons: { 
        "Okay": function() { 
         $(this).dialog("close"); 
         return true; 
        }, 
        Cancel: function() { 
         $(this).dialog("close"); 
         return false; 
        } 
       } 
      }); 

$('.trashImage').live('click', function (event) { 

    some value= "Item0289478" 

// Open DialogBox and pass some value to show user that, you are going to delete this 

if it is true 
{ 
// go to delete 

} 
else 
{ 
back.....to page 
} 

    }); 

我怎么能做到这一点,我在同一个页面中有许多不同的事件。

回答

0
function reuse(divId) 
{ 
    $("#"+divId).dialog({ 
} 

无论何时您需要显示jQuery对话框,然后只需动态传递id即可。

+0

请在你的帖子中包含你的答案的一些解释。 – 2013-03-05 16:01:44