我的模态引导程序中存在问题。 我尝试创建一个模态并在模态内创建一个模态弹出窗口。 结果是打开的,不仅在我点击按钮时打开。
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<a href="#" role="button" class="btn btn-default popover-test" title="" data-content="And here's some amazing content. It's very engaging. right?" data-original-title="A Title" aria-describedby="popover64665">button</a>
<div class="popover fade right in" role="tooltip" id="popover64665" style="top: 0px; left: 112px; display: block;">
<div class="arrow" style="top: 50%;"></div>
<h3 class="popover-title">A Title</h3>
<div class="popover-content">And here's some amazing content. It's very engaging. right?</div>
</div>
</div>
</div>
我的jsfidle
答案 0 :(得分:0)
1)你需要包括 jQuery.js 和 bootstrap.js + bootstrap.css
2)如果没有 JS ,它就无法工作,所以你需要设置例如 script.js
3)在 HTML <script src="script.js"></script>
4)在script.js
类型:
$('#myModal').on('shown.bs.modal', function () {
$('#myInput').focus();
});
希望有所帮助...... CODEPEN.io