简体   繁体   English

模态显示前执行脚本标签

[英]Execute a script tag before modal show

I am trying to show a bootstrap modal with dynamic content so one of the values being passed to the modal is the HTML to be shown in it. 我试图显示具有动态内容的引导程序模式,因此传递给模式的值之一就是要在其中显示的HTML。

My problem is that in the HTML content being passed, I have a script tag that returns an object on execution, so when the modal is shown the script tag is not being executed. 我的问题是,在传递的HTML内容中,我有一个script标签,该脚本标签会在执行时返回一个对象,因此当显示模式信息时,不会执行script标签。 Is there any way I can execute the script tag before the modal is shown so that I get the object in he HTML before I pass it to the modal? 有什么方法可以在显示模式之前执行脚本标签,以便在将对象传递给模式之前以HTML格式获取对象?

Hello you can use the below events : 您好,您可以使用以下事件:

               //The dropdown is about to be shown.
                $("#selectGroup .dropdown").on('show.bs.dropdown', function(){
                });
                //The dropdown is now fully shown.
                $("#selectGroup .dropdown").on('shown.bs.dropdown', function(){
                    //your code here
                });

Of course you change the DOM elements to fit yours.Hope helps good luck. 当然,您可以更改DOM元素以适合您的需求。

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

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