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");
});