0

我有一个提交按钮,可以在表单验证期间触发对话框打开。它在 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;
    }
});
4

1 回答 1

0

As pointed out in the question provided by Luccas, you could probably try setting a height('auto') for the dialog element:

 $( "#dialog-message_er" ).dialog({
        autoOpen: false,
        modal: true,
        show: "blind",
        hide: "drop",
        buttons: {
            Ok: function() {
                $( this ).dialog( "close" );
            }
        }
    }).height('auto');
于 2012-11-16T05:22:37.497 回答