相关疑难解决方法(0)

使用JQuery UI对话框从确认对话框返回值

I am using jQuery UI dialog to display a confirmation dialog when a button is clicked. I want to return true, when OK is clicked and false otherwise.

Associating dialog open call in onClick (as given here, $dialog.dialog('open');) event does not serve the purpose. So, as a workaround, I followed an approach, which is similar to this: http://www.perfectline.co.uk/blog/unobtrusive-custom-confirmation-dialogs-with-jquery. There are two differences between this approach and mine:

  1. The example uses anchor tag and,
  2. It does not …

html javascript jquery jquery-ui

19
推荐指数
2
解决办法
8万
查看次数

jQuery Deferred和Dialog框

function ValidateField(){
var bAllow= true;

    //some checking here

if (bAllow == true && apl.val().trim() == "")
{ 
    showDialog(); 
    showDialog().done(function() {
        return true; // wanna return true, but not success
    }).fail(function() {
        return false; //wanna return false, but not success
    });
    return false; //stop it to execute to next line
}
return bAllow; //success return }

function showDialog(){
var def = $.Deferred();
var modPop = '<div id="diaCom" title="Information?"><p>something something</p></div>';
$("#diaCom").remove();
$(modPop).appendTo('body');
$("#diaCom").dialog({
    resizable: false,
    draggable: false,
    height:150,
    width:300,
    modal: true,
    buttons: …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-ui

13
推荐指数
2
解决办法
4万
查看次数

返回jquery UI对话框的值

您可以在许多帖子(Post 1,Post2)中找到解决方案,但他们的解决方案对我不起作用.

这是我编写的普通jquery对话框.

$("#dialog").dialog({
        autoOpen:false,
        buttons:{
            "ok":function(){                                        
                        $(this).dialog("close"); 
                        return true;                                                                    
                    },
            "cancel":function(){                          
                        $(this).dialog("close");     return false;                  
                }
            }   
});
Run Code Online (Sandbox Code Playgroud)

我将用代码打开对话框:

var returnVal=$("#dialog").dialog("open");
Run Code Online (Sandbox Code Playgroud)

我需要返回false,如果用户点击"取消"并返回,true如果用户点击"确定".

var returnVal=$("#dialog").dialog("open");
Run Code Online (Sandbox Code Playgroud)

我需要returnVal返回boolean值(true/false),但它返回javascript object.

javascript jquery jquery-ui jquery-ui-dialog

4
推荐指数
2
解决办法
4万
查看次数

标签 统计

javascript ×3

jquery ×3

jquery-ui ×3

html ×1

jquery-ui-dialog ×1