I am working on 2 bootstrap modals that both lie on the same page. Bootstrap 2.3.2
The issue I'm experiencing is that whenever the modal appears, the first time you click on any of the inputs in the modal, it will immediately lose focus. After that, focus functions fine, it's just the first time.
I've found some similar issues out there, but none of their solutions have worked for me so far. Here's what I've tried:
1.)
$('#Modal').focus(function (e) {
e.preventDefault();
});
2.) Something about removing an "in" class on the modal, which mine doesn't have
3.) Trying to comment out a part of the bootstrap code, which isn't an ideal solution anyways, couldn't find the exact piece of code but something similar, but that didn't work.
4.) Both setting focus on an input (which works until something is clicked), and preventing default again.
$('#Modal').on('shown', function (e) {
e.preventDefault();
$('#textArea').focus();
});
I've pretty much exhausted google at this point, and I can't think of a way to even debug why this is happening. Either an answer or a suggested route to try would be greatly appreciated.