我们如何使用一个按钮打开更多jQuery对话框?
<script>
$(document).ready(function() {
$("#private1").dialog({
beforeClose: function(event, ui) {
removeprivate();
},
width: 460,
height: 300,
closeOnEscape: false,
hide: "fadeout",
resizable: false,
}
);
});
</script>
<div id="dialog" title="hi"></div>
我想要点击链接打开一个对话框,再次点击再打开另一个对话框等等。
答案 0 :(得分:1)
$('.button').click(function() {
$('#dialog').clone().appendTo('body').dialog({
//your dialog options goes here
}).dialog('open');
}));
答案 1 :(得分:1)
function TestMessage(message) {
$('<div class="TestDialog"></div>').appendTo('body')
.html('<div><h6>' + message + '</h6></div>')
.dialog({
modal: true, title: 'Test message', zIndex: 10000, autoOpen: true,
width: 460, height: 300, modal: false, resizable: false, closeOnEscape: false,
//hide: "fadeout",
beforeClose: function (event, ui) {
//removeprivate();
},
buttons: {
Ok: function () {
$(this).dialog("close");
}
},
close: function (event, ui) {
$(this).remove();
}
});
};
$(document).ready(function () {
$('#btnTest').live('click', function () {
TestMessage('Hi!');
});
});
直播演示,请参阅此链接:http://jsfiddle.net/nanoquantumtech/sqdkB/