I have a dynamic modal with two tabs. I want #tab1
to always be the default tab when someone opens the modal. The problem is if I open the modal and click on #tab2
then close, when I open the modal it is still on #tab2
.
JSFiddle: http://jsfiddle.net/9zo9hka4/
I'm not sure how do it. I've tried setting the tab back to #tab1
when I see the .on('hidden.bs.modal'
event but that doesn't seem to work.
Any help would be appreciated.
From the Bootstrap docs you can activate the first tab like this:
$('#myTab a:first').tab('show')
So just add that to your modal when it's closed like this:
$('#clusterprofileanomalies').on('hidden.bs.modal', function () {
//Add this line:
$('.nav-tabs a:first').tab('show');
//Snipped other non-relevant code
});
Update of your fiddle: http://jsfiddle.net/sesu6rkn/1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With