Reputation: 107
Environment
I have an iframe
that throws up a bootstrap 2.3.2 modal
.
The modal closes fine and passes back control to the iframe
nicely if the finish button is clicked.
If the modal pops up and then user then clicks somewhere off the modal, the modal disappears as I expect and the gray disappears from the screen.
But the iframe
is frozen and I can no longer click on any buttons or enter text in any field as usual.
Question
Why does this happen?
Can I get back to the iframe
without refreshing? That would be undesirable as that iframe
contains data I need to save.
Upvotes: 0
Views: 271
Reputation: 107
I figured it was something that had to do with focus. I had to add the following script inside my iFrame to regain focus. Adding the respective code in the parent window did not seem to fix it, but this did the trick in my iframe:
$('#myModal', parent.document).on('hidden.bs.modal', function (e) {
debugger;
var iframe = $("#myIframe")[0];
iframe.contentWindow.focus();
});
Upvotes: 1