Search
 
SCRIPT & CODE EXAMPLE
 

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');
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to square a value in javascript 
Javascript :: javascript regex vowel 
Javascript :: Finding the array element: 
Javascript :: refresh page scrolltop 0 
Javascript :: add class on javascript onclick function 
Javascript :: set a timer for 10 minutes 
Javascript :: tab navigation react-native without title 
Javascript :: regular expression for password 
Javascript :: give the player an item skript 
Javascript :: gatsby-plugin-create-client-paths 
Javascript :: python http request post json example 
Javascript :: javascript only allow show first few characters from a string 
Javascript :: jquery first element 
Javascript :: js get the week monday to friday date 
Javascript :: javascript get all keys of object 
Javascript :: how to generate package-lock.json from package.json 
Javascript :: react native scrollview in modal 
Javascript :: network response timed out expo 
Javascript :: javascript object to json 
Javascript :: javascript array find highest value of array of objects by key 
Javascript :: odd even condition with ternary operator 
Javascript :: jquery find child of parent sibling 
Javascript :: node readline question 
Javascript :: how to make react router Link active 
Javascript :: javascript add spaces to string 
Javascript :: javascript redirect to another page 
Javascript :: pick random value from array 
Javascript :: jquery datepicker set default date 
Javascript :: js on dom content loaded 
Javascript :: Javascript prime number check 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =