bootstrap 4 modal bug?

699 Views Asked by At
  <html><body><div class="modal fade" id="myModal">
  <div class="modal-dialog modal-xl" role="document">
  <div class="modal-content">Hello Modal</div></div></div>


  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>

  <script> function showModal { $('#myModal').modal('show') }</script>
  </body></html>

When calling showModal:

Uncaught TypeError: $(...).modal is not a function

What am I doing wrong?

1

There are 1 best solutions below

0
On

your code should look like this

 <script> function showModal() { $('#myModal').modal('show'); };</script>

this should be ok