2

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?

3
  • IE 8 won't hide it on load or close it when button is clicked in dialog? Commented Feb 7, 2012 at 23:58
  • @jk. It won't hide it on load Commented Feb 8, 2012 at 0:03
  • I also had this issue with IE8 and older, when inserting the dialog's element by $('<div></div>).appendTo(document.body) it solved by doing this by plain JS: var box = document.createElement('div'); document.body.appendChild(box); Commented Nov 9, 2013 at 6:24

4 Answers 4

2

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.

Sign up to request clarification or add additional context in comments.

6 Comments

That is my code. Are you saying use the first one or the second one?
@user1048676 I've updated the answer. Use the second one. Are you by any chance filling the content in the dialog-inner dynamically? I mean do you have <div id="dialog-inner"/> at first and populating the div with data later on?
If that didn't work, try this - <div id="dialog" class="event-dialog" title="Create Event" style="display:none;"> Explicitly set display to none. Or move display:none into the .event-dialog css class.
Actually for some reason it only doesn't work if I put in two hidden fields. If I add these two <input type="hidden" id="update_yes_no" value=""><input type="hidden" id="event_id" value=""> it doesn't work. When I take out these two it does work though.
The HTML is not valid for those fields. You're not closing the input tags.
|
2

I had a similar problem, but my solution was another: On my website there are some flash objects. These objects are rendered by IE permanently in foreground. The result is, the dialog appears behind the flash objects, and I see only the lockscreen without a dialog.

My ugly solution: I hide the flash objects before the dialog is shown. When the dialog is closed, I show the objects again. That works.

Comments

1

In my case an extra closing div is creating problem.

<div class="comment_video"  >
 // content
</div>
</div>  // this closing div is creating problem.

I have removed the last extra closing div and it's working fine. It look like IE 8 very strict with HTML standards

I hope it helps.

2 Comments

Do you have any indication from the question that an extra, closing div-tag was the problem?
It might not of helped the original person, but it was the reason the same thing was happening to me
1

I found the same bug by adding CSS class with jQuery like :

jQuery( "#dialog-noresult" ).dialog({
    modal: true,
    autoOpen: false,
    width: 500,
    height: 630,
    buttons: {
        "Cancel": {
             text: 'Cancel',
             class: 'dialog_Cancel',
             click: function() {
                 jQuery( this ).dialog( "close" );
             }
    }, ...
});

And I solved it by adding quote to the class option.

"class":'dialog_Cancel',

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.