Skip to content

Instantly share code, notes, and snippets.

@hassanuos
Created March 30, 2024 04:45
Show Gist options
  • Save hassanuos/07a3c0d69889571e5d055d8cfd39410f to your computer and use it in GitHub Desktop.
Save hassanuos/07a3c0d69889571e5d055d8cfd39410f to your computer and use it in GitHub Desktop.
$(document).ready(function (e) {
let tab = localStorage.getItem('currentTab');
if(tab == 'login'){
$("#tab-item-register").removeClass('show').removeClass('active');
$("#register-tab").attr('aria-selected', false);
$("#register-tab").removeClass('active');
}else{
$("#tab-item-login").removeClass('show').removeClass('active');
$("#login-tab").attr('aria-selected', false);
$("#login-tab").removeClass('active');
}
$("#tab-item-"+tab).addClass('show').addClass('active');
let tabId = $("#"+tab+"-tab");
tabId.attr('aria-selected', true);
tabId.addClass('active');
tabId.trigger('click');
});
$(document).on('click', '.tabs-login-register', function (e) {
localStorage.setItem('currentTab', $(this).attr('id').split('-')[0]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment