简体   繁体   中英

Cannot create a table inside a Dialog Box

The Dialog Opens fine,but there is no Table tag,i also cant see any error, so that i can sort out whats wrong.

function CreateDialog(data){
    $( "#dialog-form" ).dialog({
        autoOpen: true,
        height: 300,
        width: 350,
        modal: true,
        open: function() {
            jQuery('dialog-form').append('<table><tr>');
            jQuery.each(data, function(key, value) {
                jQuery('dialog-form').append("<td>"+value+"</td>");
            });
            jQuery('dialog-form').append('</tr></table>')
        },
        Cancel: function() {
            $( this ).dialog( "close" );
        }
    });
}

Try to change:

jQuery('dialog-form')

to:

jQuery('#dialog-form')

You're missing # to target id here.

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