var hash = window.location.hash; if(hash.indexOf('tab') > 0) { var tabID = /tab-(\d+)/.exec(hash).pop(); document.querySelectorAll('#qcTabNav a')[tabID - 1].click(); }