简体   繁体   English

BootstrapDialog,如何在对话框中显示“ display:none” div

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

I have a html page with bootstrap & BootstrapDialog. 我有一个带有bootstrap&BootstrapDialog的html页面。

In that page I have a div like this one: 在该页面中,我有一个像这样的div:

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

I want to load this one into a BootstrapDialog. 我想将其加载到BootstrapDialog中。

I tried using 我尝试使用

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

but it doesn't work because it's "display:none". 但是它不起作用,因为它是“ 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. 鉴于它是不在DOM中而是新创建的元素,因此您可能必须创建对该元素的引用,并在其中找到插入的元素。

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

BootstrapDialog.show({
    message: element
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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