I only want the Modal to show when I click on a certain button.
At the moment, the Modal shows itself whenever I load the page.
Can someone please tell me where I am going horribly wrong?
<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a> <div class="modal" id="myModal" 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> I am using ASP.NET MVC 3
EDIT: I only have the following as the Javascript:
<script> $('#myModal').on('show', function() { }); </script> These are my references to CSS and JS:
<head> <meta charset="utf-8" /> <title>@ViewBag.Title</title> <script [email protected]("https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js") type="text/javascript"> </script> <script [email protected]("../../Content/lib/bootstrap/js/bootstrap.min.js") type="text/javascript"></script> <link [email protected]("/Content/lib/bootstrap/css/bootstrap.min.css") rel="stylesheet" type="text/css" /> <link [email protected]("/Content/lib/bootstrap/css/bootstrap-responsive.min.css") rel="stylesheet" type="text/css" /> <link [email protected]("../../Content/lib/bootstrap/css/bootstrap-combobox.css") rel="stylesheet" type="text/css" /> </head>