Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

current tab active on page reload in php

$(document).ready(function() {
    if (location.hash) {
        $("a[href='" + location.hash + "']").tab("show");
    }
    $(document.body).on("click", "a[data-toggle='tab']", function(event) {
        location.hash = this.getAttribute("href");
    });
});
$(window).on("popstate", function() {
    var anchor = location.hash || $("a[data-toggle='tab']").first().attr("href");
    $("a[href='" + anchor + "']").tab("show");
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #current #tab #active #page #reload #php
ADD COMMENT
Topic
Name
6+7 =