I use bootstrap in the project. There is a page with a menu and a block in which content is loaded via ajax. The problem is that in pages loaded via ajax does not want to work (or strangely) js bootstrap. In this case, the modal window. On the main page it is created without problems, but on loaded pages it is created and then disappears immediately and then through time. What could be the problem?

  • one
    The thing is that javascript and jQuery running from the moment of initialization, in particular, does not know anything about the elements just added to the dom-дерево . You need to reinitialize the plug-ins after adding elements. - user220409 10:39
  • Re-initialize this reconnect? If yes, it did not help - antonin14d
  • I do not know exactly your case, but you should have something like this (the line is taken from the help) - $('.dropdown-toggle').dropdown() . See how jQ asked to select all elements with the class '.dropdown-toggle and initialize them. Approximately the same should be with you. This is if the reason is real in this, but this is the first thing that comes to mind. - user220409
  • The problem is solved if you use $ ('# myModal'). Modal ('show'); - antonin14d
  • So in this case, and reinitialization occurs. - ilyaplot

0