0

My web application uses multiple custom modals. The first modal always loads correctly, but further on modals don't load (the screen just greys out). I think the issue comes along with the attribute in the close button:

data-dismiss="modal"

Apparently, a solution is to attach an event listener to the button calling .modal('hide'). Is this the proper way of representing multiple modals? I am worried about simply removing data-dismiss="modal" as I don't understand its functionality well enough.

Lance Roberts
  • 22,383
  • 32
  • 112
  • 130
pasquers
  • 772
  • 1
  • 8
  • 24
  • Do you have `class="close"` on the buttons as well? You really shouldn't have to manually close these. – Barett Jun 25 '15 at 23:06
  • If you really need to add an event listener, here is a question + answer that shows how: https://stackoverflow.com/questions/12319171/how-to-handle-the-modal-closing-event-in-twitter-bootstrap – Barett Jun 25 '15 at 23:08

1 Answers1

0

I don't think there is a "proper way" to doing things. Depending on your need there is a more effective way to do things. I think in this case you are better off using the event attached to the button and hiding the modals using their ids.

$('#myModal').modal('hide');

This is a good jsFiddle

Coding Enthusiast
  • 3,865
  • 1
  • 27
  • 50