Twitter Bootstrap Modal not appearing

Any modal that I create using the boot buffer does not appear. I'm not sure what I'm doing wrong when I see that I installed the test modal code using code that downloads the boot file and it still doesn't work.

Here is my code (body only): You need to set the link to bootstrap.js, bootstrap-modal.js, jquery.js and bootstrap.css

<body> <div class="modal hide" id="myModal"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> &times; </button> <h3>Modal header</h3> </div> <div class="modal-body"> <p> Modal body would go here... </p> </div> <div class="modal-footer"> <a href="#" class="btn" data-dismiss="modal">Close</a> <a href="#" class="btn btn-primary">Save changes</a> </div> </div> <a data-toggle="modal" href="#myModal">Show Modal</a> </body> 

And here are the links to the bootstrap and jquery package that are needed to download bootstrap: the jquery boot package

+4
source share
2 answers

My problem was that I included both boostrap.js and bootstrap-modal.js. Obviously, if you included bootstrap.js, you should also not inlclude bootstrap-modal.js, because boostrap.js imports all the javascript plugins it is compatible with. Something like that. After removing my boostrap-modal.js script link, it worked.

+5
source

You need to call:

 <script> $('#myModal').modal('show') </script> 

After the </body> . Or if you only want to call it when the user clicks on something:

 $('#button_id').click(function(){ $('#myModal').modal('show') }); 
+4
source

All Articles