Created by: avalla
If you want to use a modal on another modal (I know that is a bit strange, but I needed it), when you close the second one, it removes modal-open class from body. If you have a typeahead here on the first one, the dropdown will go behind the modal.
So I fixed this issue removing the class when there is one or less modal opened, with this check:
if ($("div.modal.in").length <= 1)
The close event on second modals doesn't works the first time, the row 93 generate an error:
Uncaught RangeError: Maximum call stack size exceeded
Function called:
this.$element.trigger(e)
so I added the same check there too (I don't know if this could generate any other error, any suggest is welcome :) )
examples: error: http://jsfiddle.net/DtPY4/ fixed: http://jsfiddle.net/KQXqM/