Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to Keep the Current Tab Active on Page Reload

$('button[data-bs-toggle="tab"]').on('show.bs.tab', function(e) {
	localStorage.setItem('activeTab', $(e.target).attr('data-bs-target'));
});
var activeTab = localStorage.getItem('activeTab');
if (activeTab) {
	$('#myTab button[data-bs-target="'+activeTab+'"]').tab('show');
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #Keep #Current #Tab #Active #Page #Reload
ADD COMMENT
Topic
Name
6+9 =