开发者

jQuery UI dialog box empty content in IE

it works fine in FF, safari and Chrome.

When I call .dialog() funct开发者_StackOverflow中文版ion, it pops up the dialog box, but it has an empty content which is not suppose to be empty. It has some textfields, labels, etc.

What might have caused this?


found the solution. turns out its a css problem that the div is set to visibility:hidden on my IE css. lol. thanks anyway!


I suppose by now you are not working with IE6 anymore? LOL! Well, but this might be helpful for others.

Strangely I was googling to check for solutions when jquery dialog presents an empty content, and your post came as first link. Maybe this answer can help people with empty content being shown in jquery dialog:

In my case I had a link to invoke a function that calls jquery dialog:

<a href="javascript:showMyDialog()">Show dialog</a>

The issue is when we close and open again the link, and the content appears empty (so weird). The third, forth... times we click the same link, the content appears correctly again in dialog.

I managed to solve the problem by destroying the dialog and creating a new one dynamically.

function showMyDialog(){
$('<div id="jq_my_dialog">').html("<p>my content here will never be missing again!</p>")
            .dialog({
                title: 'Hello Stackoverflow',
                show: 'fade',
                hide: 'fade',
                minWidth: 400,
                width: 400,
                modal: true,
                close: function (event, ui) {
                    $(this).dialog('destroy').empty();
                    $('#jq_my_dialog').remove();
                }
            });
}

versions used are:

<script type="text/javascript" src="/Scripts/jquery-1.6.4.js"></script>
<script type="text/javascript" src="/Scripts/jquery-ui-1.8.16.js" ></script>


This happens every now and then, at least on IE6. Test setting zoom: 1 on various elements, which will usually solve it. What's nice is that even though it appears random, this bug is usually quite reproducible, so you can verify when you have solved it.


Unmark the compatibility view in internet explorer tools.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜