IE8不能使用jQuery对话框 [英] IE8 not working with jQuery Dialog

查看:245
本文介绍了IE8不能使用jQuery对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML表单:

 < div id =dialogclass =event-dialogtitle = 创建事件> 
< div id =dialog-inner>
< table>
< tr>< td align =left>事件名称:< / td>< td align =left>< input type =textname =name =nameclass =text ui-widget-content ui-corner-all title>< / td>< / tr>
< tr>< td align =leftvalign =top>事件描述:< / td>< td>< textarea name =descriptionid =descriptionclass = text ui-widget-content ui-corner-allrows =3cols =40>< / textarea>< / td>< / tr>
< tr>< td align =left>全天事件:< / td>< td align =left>< input id =all-daytype =复选框value =false>< / td>< / tr>
< / table>
< / div>
< / div>

我还有以下jQuery代码:

  jQuery(#dialog)。对话框({
autoOpen:false,
height:600,
width:700,
modal:true,
按钮:{
'创建事件':function(){
name = jQuery(#name)。val();
jQuery(this) .dialog('close');
},
取消:function(){
jQuery(this).dialog('close');
}
} ,
close:function(){
}
});

我删除了jQuery代码中的一些东西,只是为了缩短StackOverflow。该代码适用于Chrome,Firefox,Safari等,但由于某种原因,它只是在IE8中显示对话框。任何想法为什么它不会隐藏在IE8的形式?

解决方案

我有一样的事情发生在我之前。这是您的确切HTML代码吗?如果没有,请确保您不要在对话框中使用自动关闭标签。

 < div id =dialog-save> 
< div id =content/> //这个没有工作。
< div id =content>< / div> //这个工作。
< / div>

由于某种原因,IE不喜欢jquery-ui的自我关闭标签。 >

I have an HTML form:

<div id="dialog" class="event-dialog" title="Create Event">
    <div id="dialog-inner">
    <table>
        <tr><td align="left">Event Name:</td><td align="left"><input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all title"></td></tr>
        <tr><td align="left" valign="top">Event Description:</td><td><textarea name="description" id="description" class="text ui-widget-content ui-corner-all" rows="3" cols="40"></textarea></td></tr>
        <tr><td align="left">All Day Event:</td><td align="left"><input id="all-day" type="checkbox" value="false"></td></tr>
     </table>
     </div>
</div>

I also have the following jQuery code:

jQuery("#dialog").dialog({
    autoOpen: false,
    height: 600,
    width: 700,
    modal: true,
    buttons: {
        'Create event': function () {
            name = jQuery("#name").val();
            jQuery(this).dialog('close');
        },
        Cancel: function () {
            jQuery(this).dialog('close');
        }
    },
    close: function () {
    }
});

I removed some stuff in my jQuery code just to shorten it up for StackOverflow. The code works in Chrome, Firefox, Safari, etc., but, for some reason, it just displays the dialog form in IE8. Any idea why it wouldn't hide the form in IE8?

解决方案

I had the same thing happen to me a while ago. Is this your exact HTML code? If not, make sure you don't use self-closing tags within the dialog div.

 <div id="dialog-save">
    <div id="content" /> //this one didn't work.
    <div id="content"></div> //this one worked.
 </div>

For some reason, IE doesn't like self-closing tags for jquery-ui.

这篇关于IE8不能使用jQuery对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆