I\'m working on a website using bootstrap.
Basically, I wanted to use a modal in the home page, summoned by the button in the Hero Unit.
Button code:
Had to face the same issue. The reason is same as the @merv
. Issue was with a calendar component added to the page.The component itself add the modal feature to be used in the calendar popup.
So the reasons to break model popup will be one or more of the following
My code somehow had the bootstrap.min.js included twice. I removed one of them and everything works fine now.
I too had the issue, if the button is inside a tag then the modal appears once and disappears soon enough, taking the button out of the form fixed the isue. Thanks I ended up in this thread! +1 to all.
I was facing the same problem during testing on mobile devices and this trick worked for me
<a type="submit" class="btn btn-primary" data-toggle="modal" href="#myModal">Submit</a>
Change the button to anchor tag it should work, the problem occurs due to its type button as it is trying to submit so the modal disappears immediately.and also remove hide from modal hide fade give
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
Hope this would work for you .
I know this is old, but here's another thing to check for - make sure you only have one data-target= attribute. I had duplicated it and the result was as per this thread.
I looked for a while for a duplicate bootstrap reference in my mvc app, after the other helpful answers on this question.
Finally found it - it was included in another library I was using, so wasn't obvious at all! (datatables.net
).
If you still get this problem, look for other libraries that might be including bootstrap for you. (datatables.net
allows you to specify a download with or without bootstrap - others do the same).
So I removed the bootstrap.min.js
from my bundle.config
and all worked fine.