本文介绍了jqueryUI对话框返回bool的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用带有2个按钮的jQueryUi对话框作为javascript中的confirm(msg)的替换。

初始化jqueryUI对话框:

Hi,
I am using jQueryUi dialog with 2 buttons as a replacement of confirm(msg) in javascript.
initializing the jqueryUI dialog:

$(function() {
    	$('#id').dialog({
        	autoOpen: false,
        	width: 600,
        	buttons: {"Yes": yes, "No": no},
        	modal: true
        });
     });
function yes(){
    	$('#id').dialog( "close" );
    	 return true;
	}
function no(){
    	$('#id').dialog( "close" );
    	return false;
	}



在jqueryUI中有2个步骤:

1.


In jqueryUI there is 2 steps:
1.

$("id").dialog('open');// which opens the dialog



2.基于按钮点击返回true / false。



我从一个函数打开这个对话框在另一个JS文件中打开()。

如何确认确认功能(msg),即控件等到用户点击按钮并返回true / false?


2. based on the button click returns true/false.

I am opening this dialog from a function Open() in a another JS file.
How can I have exact functionality as confirm(msg), ie the control waits till the user clicks on a button and returns true/false?

Open()
{......
//var choice = confirm("MSG");<-- returns true/false based on the button click
..opens the jqueryUI dialog
..blocks the control till the user clicks on the buttons
var choice = <-- returns true/false based on the button click
....
}





任何帮助表示赞赏。

谢谢此致,

Sayan。



Any help is appreciated.
Thanks and Regards,
Sayan.

推荐答案




这篇关于jqueryUI对话框返回bool的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 23:17