multiple modals and data-dismiss="modal"

时间:2015-06-25 18:27:46

标签: javascript jquery twitter-bootstrap

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.

1 个答案:

答案 0 :(得分: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