I am using the Twitter bootstrap Modal dialog. When I click on the submit button of the bootstrap modal dialog, it sends an AJAX request. My problem is that the modal-backdrop doesn't disappear. The Modal dialog does disappear correctly, but instead "modal-backdrop in" that creates the opacity on the screen remain
What can I do?
Insert in your action button this:
and
example:
if you enter this data-attr the .modal-backdrop will not appear. documentation about it at this link :http://getbootstrap.com/javascript/#modals-usage
If you are using a copy and paste from the getboostrap site itself into an html generated selector, make sure you remove the comment '<!-- /.modal -->'. Bootstrap gets confused and thinks that the comment is a second modal element. It creates another back drop for this "second" element.
I had this very same issue.
However I was using bootbox.js, so it could have been something to do with that.
Either way, I realised that the issue was being caused by having an element with the same class as it's parent. When one of these elements is used to bind a click function to display the modal, then the problem occurs.
i.e. this is what causes the problem:
change it so that the element being clicked on doesn't have the same class as it's parent, any of it's children, or any other ancestors. It's probably good practice to do this in general when binding click functions.
the initial value of your data-backdrop attribute can be
"static","true", "false" .
static and true add the modal shadow, while false disable the shadow, so you just need to change this value with the first click to false . like this:
This solution is for Ruby on Rails 3.x and a js.erb file that rebuilds part of the DOM including the modal. It works regardless if the ajax call came from the modal or from a different part of the page.
Thanks to @BillHuertas for the starting point.
I had the same problem. I discovered it was due to a conflict between Bootstrap and JQueryUI.
Both use the class "close". Changing the class in one or the other fixes this.