I having idea how to open jquery dialog, but what's wrong with below code, please suggest.
here is fiddle link,
<a href="#" class="dialogLink">Open Dialog</a>
<div id="popId"></div>
I having idea how to open jquery dialog, but what's wrong with below code, please suggest.
here is fiddle link,
<a href="#" class="dialogLink">Open Dialog</a>
<div id="popId"></div>
为什么你在load
通话中有你的对话?
这不是必需的,您还没有定义dialogTitle
哪个会在初始化时引发错误。
尝试这个
jQuery(document).ready(function () {
$('.dialogLink').live('click', function () {
$("#popId").dialog({
modal: true,
resizable: false,
title: '', // Set this to an actual variable or string
minWidth: 800,
minHeight: 300,
closeOnEscape: false,
buttons: {
"Cancel": function () {
$(this).dialog('close');
}
}
});
});
});
要详细说明上一个答案,您根本不需要调用 load 方法
。相反,您需要使用 $("#popId") 选择器而不是 $(this) 来调用 .dialog 方法。
这是一个工作示例:
jQuery(document).ready(function () {
$('.dialogLink').live('click', function () {
$("#popId").dialog({
modal: true,
resizable: false,
title: "This is my test title",
minWidth: 800,
minHeight: 300,
closeOnEscape: false,
buttons: {
"Cancel": function () {
$(this).dialog('close');
}
}
});
});
});