Answers for "laravel redirect back to same tab after reload"

PHP
0

laravel redirect back to same tab after reload

$(document).ready(function() {
  let tabID = localStorage.getItem('activeTab');
  if (tabID) {
    $("a[href='" + tabID + "']").tab("show");
  }

  $(document.body).on("click", "a[data-toggle='tab']", function(event) {
    console.log(event.target);
    localStorage.setItem('activeTab', this.getAttribute("href"));
  });
});

$(window).on("popstate", function() {
  var anchor = localStorage.getItem('activeTab') || $("a[data-toggle='tab']").first().attr("href");
  $("a[href='" + anchor + "']").tab("show");
});
Posted by: Guest on October-06-2021

Code answers related to "laravel redirect back to same tab after reload"

Browse Popular Code Answers by Language