开发者

jquery UI dialog and button refresh

开发者 https://www.devze.com 2023-01-06 14:13 出处:网络
well i\'m back... i\'m trying to make jquery UI\'s button and dialog plugins work with my form.i want the reset button

well i'm back... i'm trying to make jquery UI's button and dialog plugins work with my form. i want the reset button

<button id="opener" value="reset" type="submit">Reset</button>

to pull up a confirmation dialog, which it does. cancel should dismiss dialog and set the button back to its original state. it dismisses fine but the button maintains its hover state, even though i have tried adding the .refresh method just about everywhere i can think of.

jQuery(document).ready(function($) {

$(".dialog").dialog({
            autoOpen: false,
            resizable: false,
            modal: true,
            title: 'Warning!',
            close: function () {
                $('#opener').button('refresh');
                },
            buttons: {
                'Continue': function() {
                    $(this).dialog('close');    
                },
                Cancel: function() {
                    $(this).dialog('close');
                    $('#opener').button('refresh')
                }
            }
        });


$('#opener').click(function() {
            $('.dialog').dialog('open');
            $(this).button('refresh')
            return false;
        });
});

then on a Continue response the button should continue with its original purpo开发者_运维知识库se.. which doesn't happen. i get a return: false type of behavior w/o return: false anywhere.


someone at the jquery forum answered me that for the first part i need to add

close: function () {
$('#opener').removeClass('ui-state-focus');
},

to the dialog commands. and

$('#myform').submit();

to the the continue function

0

精彩评论

暂无评论...
验证码 换一张
取 消