Answers for "tab change hash"

0

tab change hash

// jquery
$('a').on('click', function (e) {
    e.preventDefault();
    let link = $(this).attr('href');
    if (link.includes('#') !== false) {
    window.location.hash = this.hash.substr(1);
	}
});
Posted by: Guest on February-07-2022
0

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');
    });
Posted by: Guest on February-07-2022

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language