在IE8中只出现一次JQuery UI对话框

时间:2012-11-16 05:03:04

标签: jquery jquery-ui internet-explorer-8 dialog

我有一个提交按钮,可以在表单验证期间触发对话框打开。它在Firefox和Chrome中运行良好,但在IE8中,在它出现一次后我关闭它,当我再次单击该按钮时,只显示叠加模式,对话框消失。这是我的代码:

//VALIDATION OF FORM STARTS HERE
$('input[type="submit"]').click(function() {

    //create the dialog box
    $.fx.speeds._default = 500;
    $( "#dialog-message_er" ).dialog({
        autoOpen: false,
        modal: true,
        show: "blind",
        hide: "drop",
        buttons: {
            Ok: function() {
                $( this ).dialog( "close" );
            }
        }
    });

    if (empty) {
        //get the count of errorforms
        required_length = error_forms_req.length;
        //get the list of missed required fields
        var reqlist = '';
        for (var i=0; i<required_length; i++) {
           reqlist += '<li>' + error_forms_req[i] + '</li>';
         }

        $('#dialog-message_er ul').append('<li class="req">You have missed the following required fields <ul> ' + reqlist + ' </ul></li>'); 

        $( "#dialog-message_er" ).dialog( "open" );
        return false;
    } else { 
        return true;
    }
});

1 个答案:

答案 0 :(得分:0)

正如Luccas提供的问题所指出的那样,您可以尝试为对话框元素设置height('auto')

 $( "#dialog-message_er" ).dialog({
        autoOpen: false,
        modal: true,
        show: "blind",
        hide: "drop",
        buttons: {
            Ok: function() {
                $( this ).dialog( "close" );
            }
        }
    }).height('auto');