tabLinks = $('#relatedTabBar li a'); numOfTabs = tabLinks.length;
for (index = 0; index < numOfTabs; index ++) { oldAnchor = $(tabLinks[index]).attr('href'); hashPos = oldAnchor.indexOf('#'); newAnchor = oldAnchor.substr(hashPos); $(tabLinks[index]).attr('href', newAnchor); } Sorry code was wrong before