Reputation: 1519
It appears that the default behavior of Bootstraps
modal
is to focus in on the link used to open the modal
when you close it.
I'm trying to take the focus away from the link I click to open the modal
when I close it. it doesn't have to focus on anything specific, just not the opening link.
My code so far seems to be doing nothing:
<script type="text/javascript">
$('#myModal').on('hide.bs.modal', function (e) {
$('.close').on("click", function() {
$("#profile").blur();
});
});
</script>
Upvotes: 1
Views: 2684
Reputation: 439
You code attaches an event listener to the element with class .close
when the modal is hidden rather than executing the $("#profile").blur();
line.
You can just do
$('#myModal').on('hidden.bs.modal', function (e) {
$("#profile").blur();
});
Upvotes: 1