I have a confirmation dialog in jquery that pops up and show some confirmation details. What I'm trying to do is that if the user clicks YES, I want to use THE SAME confirmation dialog box but with a smaller text like "Please wait..." or something. For that, I would want to ajust my dialog dimensions accordingly (meaning, after the user clicks YES, I want my dialog to be smaller since there will only be a small text inside of it). How do I achieve something like this? How do I change the size of my dialog after the user has clicked YES?
我在jquery中有一个确认对话框弹出并显示一些确认细节。我想要做的是,如果用户单击是,我想使用相同的确认对话框,但使用较小的文本,如“请稍候......”或其他东西。为此,我希望相应地调整我的对话框尺寸(意思是,在用户单击“是”之后,我希望我的对话框变小,因为其中只有一个小文本)。我如何实现这样的目标?用户单击“是”后如何更改对话框的大小?
Also, I know in javascript confirmation box, if the user clicks OK, TRUE is return, else false is return. Is it the same for jquery modal confirmation boxex? How do I know if the user hit YES or CANCEL?
另外,我知道在javascript确认框中,如果用户单击OK,则返回TRUE,否则返回false。 jquery模态确认boxex是否相同?如何知道用户是YES还是CANCEL?
Thank you
谢谢
1 个解决方案
#1
7
I think this is what you are looking for. You can change the height of your confirmation box:
我想这就是你要找的东西。您可以更改确认框的高度:
$( "#dialog-confirm" ).dialog({
width : 100,
height:100
});
And can add buttons to it and track the clicks:
并可以添加按钮并跟踪点击次数:
$( "#dialog-confirm" ).dialog({
width : 100,
height:100,
modal: true,
buttons: {
"Ok": function() {
alert('ok');
$( this ).dialog( "close" );
},
Cancel: function() {
alert('cancel');
$( this ).dialog( "close" );
}
}
});
In addition to it, the documentation is way too in detail here. http://jqueryui.com/demos/dialog/
除此之外,这里的文档也非常详细。 http://jqueryui.com/demos/dialog/
Demo : http://jsfiddle.net/zgN2X/2/
演示:http://jsfiddle.net/zgN2X/2/
#1
7
I think this is what you are looking for. You can change the height of your confirmation box:
我想这就是你要找的东西。您可以更改确认框的高度:
$( "#dialog-confirm" ).dialog({
width : 100,
height:100
});
And can add buttons to it and track the clicks:
并可以添加按钮并跟踪点击次数:
$( "#dialog-confirm" ).dialog({
width : 100,
height:100,
modal: true,
buttons: {
"Ok": function() {
alert('ok');
$( this ).dialog( "close" );
},
Cancel: function() {
alert('cancel');
$( this ).dialog( "close" );
}
}
});
In addition to it, the documentation is way too in detail here. http://jqueryui.com/demos/dialog/
除此之外,这里的文档也非常详细。 http://jqueryui.com/demos/dialog/
Demo : http://jsfiddle.net/zgN2X/2/
演示:http://jsfiddle.net/zgN2X/2/