JQuery tabs - using window.location.hash based on a not li
<p>Reading through other answers, I realise I should have coded my site differently, as there are plenty of answers if only I'd used .selected on my li rather than my a, but basically I am using JQuery to make a set of tabbed content work but can't figure out how to display a tab based on the URL# (e.g. mypage#tab3 to load mypage with tab3 showing rather than the first tab).</p>

<p>My javascript is currently as follows:</p>

<pre><code>$(document).ready(function () {
    var tabContainers = $('div.tabholder &gt; div');
    var tabLinked = window.location.hash;

    function loadTab() {
        tabContainers.hide().filter(this.hash).show();

        $('li.tabnav a').removeClass('selected');
        $(this).addClass('selected');

        return false;
    }

    if (window.location.hash!='') {    
        $('li.tabnav a').click(loadTab).filter(tabLinked).click();
    } else {
        $('li.tabnav a').click(loadTab).filter(':first').click();
    }

});
</code></pre>

<p>I know it's the line with filter(tabLinked) that's wrong, but don't know what it should be - any help much appreciated!</p>
