Tabs "Jump To" Button

Tabs "Jump To" Button

I am trying to have buttons within a tab to jump to a different tab, but get the following error:  Error: cannot call methods on tabs prior to initialization; attempted to call method 'enable'.  Below is the code I tried.  What is the correct way to implement this?  


  1. <div id="tabs" >
  2.   <ul>
  3.     <li><a href="#tabs-1">Nunc tincidunt</a></li>
  4.     <li><a href="#tabs-2">Proin dolor</a></li>
  5.     <li><a href="#tabs-3">Aenean lacinia</a></li>
  6.   </ul>

  7.   <div id="tabs-1">  <input id="lnk" type="button" value="Jump to Tab 3"  />    </div>
  8.  <div id="tabs-2" >   Tab2  </div>
  9.   <div id="tabs-3" >  Tab 3 </div>
  10. </div>

  1. <script>
  2.   $(function() {
  3.     $( "#tabs" ).tabs();
  4.   });
  5.  
  6. $(function(){
  7.     $('#lnk').click(function() {
  8.       $( "#tabs-3" ).tabs("enable");  
  9.     });
  10. });

  11.   </script>