Reputation: 3029
I am trying to use Bootstrap modal. I have imported bootstrap-modal.js
I need to trigger the modal using button attribute not JS.
Here is my code which doesn;t allow the modal to work !
<!-- Button to trigger modal -->
<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a>
<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>
Upvotes: 0
Views: 11733
Reputation: 1321
Your code is working perfectly . You should also include Jquery into your page. Add this before importing bootstrap.js
<script src="http://code.jquery.com/jquery-latest.js"></script>
Also don't forget to link with bootstrap css file in the head section.
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
Upvotes: 11