Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
191
rated 0 times [  194] [ 3]  / answers: 1 / hits: 141421  / 12 Years ago, sat, may 12, 2012, 12:00:00

I am trying to get a simple bootstrap's modal sample to work, I follow this document which says You can activate modals on your page easily without having to write a single line of javascript. Just give an element a data-controls-modal attribute which corresponds to a modal element id, ..., but I have done whatever I could and had a huge amount of research still can not get this simple modal to work.



<div class=modal id=myModal>
<div class=modal-header>
<button class=close data-dismiss=modal>×</button>
<h3>Modal header</h3>
</div>
<div class=modal-body>
<p>One fine body…</p>
</div>
<div class=modal-footer>
<a href=# class=btn>Close</a>
<a href=# class=btn btn-primary>Save changes</a>
</div>
</div>


I have either this:



<a class=btn data-controls-modal=myModal>Launch Modal</a>


or this:



<a class=btn data-toggle=modal href=#myModal >Launch Modal</a>


button to activate the modal, I have loaded the bootstrap-modal.js on the page as well. Unless I added a javascript line to handle the Launch Modal click event, when I click on Launch Modal, nothing happens at all, are there anything that I have missed?


More From » jquery

 Answers
18

I finally found this solution from Sven and solved the problem. what I did was I included bootstrap.min.js with:



<script src=bootstrap.min.js/>


instead of:



<script src=bootstrap.min.js></script>


and it fixed the problem which looked really odd. can anyone explain why?


[#85632] Thursday, May 10, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
scarlett

Total Points: 491
Total Questions: 94
Total Answers: 100

Location: New Caledonia
Member since Thu, Mar 23, 2023
1 Year ago
scarlett questions
Tue, Aug 17, 21, 00:00, 3 Years ago
Sat, May 1, 21, 00:00, 3 Years ago
Wed, Jun 17, 20, 00:00, 4 Years ago
;