Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

tab change hash

$(document).ready(function() {
        if (window.location.hash) {
            let hash = window.location.hash;
            $('.nav-link').removeClass('active');
            $('.tab-pane').removeClass('active');
            $('.nav-link[href="' + hash + '"]').click();
        }
    });


    $('.nav-tabs a').on('click', function() {
        window.location.hash = $(this).attr('href');
    });
 
PREVIOUS NEXT
Tagged: #tab #change #hash
ADD COMMENT
Topic
Name
5+5 =