admin管理员组

文章数量:1291085

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?

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?

Thank you

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?

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?

Thank you

Share Improve this question asked Mar 6, 2012 at 5:15 user765368user765368 20.4k27 gold badges101 silver badges171 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

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./demos/dialog/

Demo : http://jsfiddle/zgN2X/2/

本文标签: javascriptchange size of jquery modal confirmation dialogStack Overflow