简体   繁体   中英

Jquery dialog IE9 content not showing using html

I have dont a smalle web application for a client. I have tested it in firefox, chrome, IE7, IE8 and IE9.

Now I cant get it to fail. Its working in every browser/version I have tested. Im not sure what build my client is sitting with but he said it was IE9.

The code is this:

function noticeBox(type, html, title) {
switch(type) {
    case 1:
    $('#notice_box').dialog({
        title: title,
        width: 400,
        modal: true,
        position: 'center',
        buttons: {
            'Ok': function() {
                $(this).dialog('close');
            }
        }
    });     
    break;
    case 2:
    $('#notice_box').dialog({
        title: title,
        width: 800,
        modal: true,
        position: 'center',
        buttons: {
            'Bekræft og bestil': function() {
                $('#form_products').submit();
            },
            'Annuller': function() {
                $(this).dialog('close');
            }
        }
    });     
    break;
    case 3:
    $('#notice_box').dialog({
        title: title,
        width: 400,
        modal: true,
        position: 'center',
        buttons: {
            'Luk': function() {
                $(this).dialog('close');
            }
        }   
    });
    break;
}
alert(html);
$('#notice_box').html(html);
$('#notice_box').dialog('open'); }

Not a very generic function but thats what is failing at the moment. He says that when the dialog pop's there is no content in the dialog. He can see the buttons but is like there is no html in the dialog it self.

Any ideas?

UPDATE: Btw he can active several dialogs and the result is the same in all of them. Dialogs without any content.

UPDATE2: An example how I use that function is this. When a client orders some products:

function order() {
var procuct_str = '';
var found_order = false;
$.each($('.order_input'), function(){
    var product_id = $(this).attr('id').split('-');
    if(parseInt($(this).val()) > 0) {
        found_order = true;
        procuct_str = procuct_str+'<div class="float_left"><span class="bread_text">'+$('#description-'+product_id[1]).text()+'</span></div><div class="float_right"><span class="bread_text">'+$(this).val()+'</span></div><div class="clear"></div>';
    }
}); 

if(found_order == true) {
    procuct_str = '<div class="float_left"><b>Beskrivelse</b></div><div class="float_right"><b>Antal kasser</b></div><div class="clear"></div>'+procuct_str;

    noticeBox(2, procuct_str, 'Bekræftelse');
    var found_order = false;
} }

Your html variable needs to be accessed within the scope of the function, unless you've declared it elsewhere. From the code you provided, html is a function argument, and outside the function it will always be 'undefined'.

It works fine for me.

I used your function like this:

noticeBox(1, "<p>Hello</p>", "Test");

What is your client supplying for the html-argument? Some html could possibly mess it up. Or simply maybe your client left it out which would explain why nothing is showing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM