I'm using bootstrap's modal plugin in rails
The website says I can gain the function without write javascript.
I add the following line in my HTML(in slim):
div#makeDream.modal.hide.fade div.modal-header a.close data-dismiss='modal' h3 Hello World! div.modal-body div.modal-footer a data-toggle='modal' data-target='#makeDream' Button
However, after I clicking the Button
. the modal shows up, but immediately disappears!
I found the css of #makeDream
has
display:none
I don't where it comes
Can someone tell me how to fix it?
When the Button is clicked, the HTML DIV is referenced using jQuery and its modal function is called along with properties data-backdrop: "static" and data-keyboard: false which disables the closing of the Bootstrap Modal Popup when clicked outside.
You can prevent closing of modal dialog by setting the beforeClose event argument cancel value to true. In the following sample, the dialog is closed when you enter the username value with minimum 4 characters.
Data-keyword="false" is to prevent closing modal while clicking Esc button, while data-backdrop="static" , allows you keep modal pop-up opened when clicking on Gray area.
Show activity on this post. and write your html code in update panel then remove data-dismiss="modal" from the button. Hope it works for you. It would be great if you could add some explanation to your code.
I had this problem and the solution was simple... I was loading both bootstrap.js AND bootstrap-modal.js.
bootstrap.js includes bootstrap-modal.js.
Solution: Remove bootstrap-modal.js from your head
and it'll work correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With