title: dynamically select jquery UI tabs based on hash ID from a text link inside tabs
body: <p>I have a set of jQuery UI tabs that is generated by a CMS, so content will be different for every page. Some tabs sets could have two tabs, others could have 5 etc. </p>
  
  <p>I have looked around for a simple solution to this but cant seem to find it.  i have looked at the history plugin as well as alternate codes.</p>
  
  <p>Here's my sample markup</p>
  
  <pre><code>&lt;div id="tabs"&gt; 
  &lt;ul&gt;
  &lt;li&gt;&lt;a href="#tabs-1"&gt;TAB 1 HEADING&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#tabs-2"&gt;TAB 2 HEADING&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#tabs-3"&gt;TAB 2 HEADING&lt;a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#tabs-4"&gt;TAB 3 HEADING&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/div&gt;
  
  &lt;div id="tabs-1"&gt;tab1 content here&lt;/div&gt;
  &lt;div id="tabs-2"&gt;tab2 content here&lt;/div&gt;
  &lt;div id="tabs-3"&gt;tab2 content here&lt;/div&gt;
  &lt;div id="tabs-4"&gt;tab4 content here&lt;/div&gt;
  </code></pre>
  
  <p>I want to create a script that allows the user to alternately select a tab from a text link within the tabbed content. So for example, in the tab content div, have  that links to the 3rd tab, as the tab navigation does.  I don't want to have to manually code the index of the desired tab in the script.</p>
  
  <p>I know this will work, but want to create something that is more robust across all my tabbed content.</p>
  
  <pre><code>$("#tabs").tabs("select" , "#tab-4");
  </code></pre>
  
  <p>Here is what i have so far, but doesnt seem to work. I am new to jQuery. I have added an onlick called tabJump to the anchor links. </p>
  
  <pre><code>function tabJump(){
      //get href ID as a number
      var thisID = Number($(this).attr('href').replace(/#tabs-/, '')) - 1;
      // this should trigger the new tab based on this href id.
      $("#tabs").tabs("select" , "#tabs-" + thisID);
  };  
  </code></pre>
  
  <p>And ideas on how i could get this to work? Essentially i want whatever the id of the tag as the href of the anchor link being clicked, and to target the new tab by this given id. I would want to have multiple instances of a link with these id hrefs.</p>
  
  <p>Thanks in advance.</p>