/* 1. Getting the hash value from current URL 2. Traversing all tab buttons 3. checking hash attribute with in each href of tab buttons 4. if there click on it to perform hash change //akhil */ $(".nav-tabs").find("li a").last().click(); var url = document.URL; var hash = url.substring(url.indexOf('#')); $(".nav-tabs").find("li a").each(function(key, val) { if (hash == $(val).attr('href')) { $(val).click(); } $(val).click(function(ky, vl) { console.log($(this).attr('href')); location.hash = $(this).attr('href'); }); });