代码之家  ›  专栏  ›  技术社区  ›  helgatheviking

jqueryui对话框和按钮刷新

  •  1
  • helgatheviking  · 技术社区  · 16 年前

    我回来了。。。我试图让jqueryui的按钮和对话框插件与我的表单一起工作。我要复位按钮

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

    打开一个确认对话框。取消应关闭对话框并将按钮设置回其原始状态。它很好地拒绝了,但是按钮保持了它的悬停状态,即使我尝试在我能想到的任何地方添加.refresh方法。

    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;
            });
    });
    

    然后在“继续”响应中,按钮应继续其原始用途。。但这不会发生。我得到一个return:false类型的行为,而没有return:false。

    1 回复  |  直到 16 年前
        1
  •  1
  •   helgatheviking    16 年前

    jquery论坛上有人回答我,第一部分我需要补充

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

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

    继续函数的步骤

    推荐文章