title: How to count "visible" tabs in jquery?
body: <p>I inherited this code and now need to make modifications.  I have a series of tabs:  </p>
  
  <pre><code>&lt;div id="Tabs"&gt;
      &lt;ul&gt;
          &lt;li&gt;&lt;a href="#divGen" id="lnkGeneral"&gt;General&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#divA" id="lnkA"&gt;A&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#divB" id="lnkB"&gt;B&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#divC" id="lnkC"&gt;C&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>These are hidden/shown using jquery depending on the value selected from a dropdown:</p>
  
  <pre><code>$("#divA").hide(); $("#divB").show(); $("#divC").hide();  
  $("#lnkA").hide(); $("#lnkB").show(); $("#lnkC").hide();
  </code></pre>
  
  <p>The first tab (divGen) is always displayed.  I need a way to loop through the list of tabs to determine which tabs may be visible, as I am adding a button to go to the next tab.  Because the tabs are visible on a dynamic basis I need to determine both if the button should be shown and which tab to ‘rotate’ to when pressed.  I have tried the following with no luck:</p>
  
  <pre><code>var $tabs = $('#Tabs').tabs();  
  var i, count = 0;  
  for (i = 0; i &lt; $tabs.tabs('length'); i++) {  
      if ($tabs.tabs(i).is('visible')) {  
          count++;  
      }  
  }  
  
  if (count &gt; 1)) {  
      Display the button.  
  }
  </code></pre>
  
  <p>What am I missing?  I have looked at all the examples and cannot find a solution.  I have an idea it is due to the hide/show and not doing the visible test correctly.</p>
  
  <p>Thank You in advance</p>