user481610
user481610

Reputation: 3270

Twitter Bootstrap Modal - not appearing

I'm looking to use the twitter bootstrap modal functionality. As such I have copy pasted out of the docs and include all the files. But every time I click my button nothing appears and I'm not sure why:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Testing</title>

    <link rel="stylesheet" type="text/css" href="css/bootstrap-theme.css">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
    <script src="js/jquery-1.10.2.js"></script>
    <script type="js/bootstrap.js"></script>
</head>
<body style="background:#bf9d93;">

    <!-- Button trigger modal -->
<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" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>


</body>
</html>

Now according to the docs, under the usage section I am allowed to simply use the code above and invoke the modal via the data attributes. As such this is my first time using the element so I'm sure its a silly thing I've over looked but I cant see what it is...

Upvotes: 0

Views: 135

Answers (2)

ajtrichards
ajtrichards

Reputation: 30565

Check line 8 of your code. You have:

<script type="js/bootstrap.js"></script>

Instead of:

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

Without correctly loading the bootstrap.js file it won't work.

Upvotes: 4

Jonathan Anctil
Jonathan Anctil

Reputation: 1037

On click event call:

$('#myModal).modal({ show: true }); 

Upvotes: -1

Related Questions