Bootstrap模态对话框中显示动态内容的方法

今天小编就为大家分享一篇Bootstrap模态对话框中显示动态内容的方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧

首先引入bootstrap的js和css,在引入对应版本的jquery;

添加按钮,点击弹出模态窗体:

<button data-toggle="modal" data-target="#modal" href="https://www.jb51.net/Home/Test" ></button>

创建模态对话框:

<div tabindex="-1" role="dialog" aria_labelledby="myModelLabel" aria-hidden="true"> <div> <div></div> <button data-dismess="modal">确定</div> <button data-dismess="modal">取消</div> </div> </div> <script> var modelResult; $(function(){ $("#model").on("hide.bs.modal"), function(){ //在这里应用二级窗体返回的内容 }) }); function btnSaveClick(){ modelResult = this.parent.$("#txtName").val(); } </script>

注意:如果发现二级窗体打开一次后再打开失败,请看看href引用的界面中,是否在header中引入了css或js,这里不需要再进行引用,动态加载后会继承父窗体的js和样式

以上这篇Bootstrap模态对话框中显示动态内容的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/b7669c18dcf30d35eed057fa2091e10a.html