简体   繁体   中英

BootstrapDialog, how to show “display:none” div into the dialog

I have a html page with bootstrap & BootstrapDialog.

In that page I have a div like this one:

<div id="divtoload" style="display:none">Test</div>

I want to load this one into a BootstrapDialog.

I tried using

BootstrapDialog.show({
        message: $('<div></div>').load('index.html #divtoload')
    });

but it doesn't work because it's "display:none".

Couldn't you just show it once it's loaded.

Seeing as it's an element that's not in the DOM, but newly created, you probably have to create a reference to that element, and the find the inserted element inside etc.

var element = $('<div></div>').load('index.html #divtoload', function() {
    element.find('#divtoload').show();
});

BootstrapDialog.show({
    message: element
});

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