title: Find currently visible div in jquery
body: <p>I have a four divs all set <code>display:none</code> and on document.ready i am showing the first div.. I have 4 link buttons link1,link2...link4... I showing div1 on link1 click and so on.. How to find which div is currently visible in jquery?</p>
  
  <pre><code> &lt;style type="text/css"&gt;
          .ContentDivs
          {
              width: 90%;
              height: 300px;
              border: solid 5px #404040;
              display:none;
          }
      &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;div&gt;
          &lt;div&gt;
              &lt;a id="Link1" href="#"&gt;Link1&lt;/a&gt; 
              &lt;a id="Link2" href="#"&gt;Link2&lt;/a&gt;
               &lt;a id="Link3" href="#"&gt;Link3&lt;/a&gt; 
               &lt;a id="Link4" href="#"&gt;Link4&lt;/a&gt;
          &lt;/div&gt;
          &lt;div id="div1" class="ContentDivs"&gt;
          DIv1
          &lt;/div&gt;
          &lt;div id="div2" class="ContentDivs"&gt;
          Div2
          &lt;/div&gt;
          &lt;div id="div3" class="ContentDivs"&gt;
          Div3
          &lt;/div&gt;
          &lt;div id="div4" class="ContentDivs"&gt;
          Div4
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;script type="text/javascript"&gt;
          $(document).ready(function() {
                $("#div1").show().fadeIn("slow");
          });
          $('#Link1').click(function() {
          $(".ContentDivs").fadeOut("fast");//find current div here?
              $("#div1").show().fadeIn("slow");
          });
          $('#Link2').click(function() {
          $(".ContentDivs").fadeOut("fast");//find current div here?
              $("#div2").show().fadeIn("slow");
          });
          $('#Link3').click(function() {
          $(".ContentDivs").fadeOut("fast");//find current div here?
              $("#div3").show().fadeIn("slow");
          });
          $('#Link4').click(function() {
          $(".ContentDivs").fadeOut("fast");//find current div here?
              $("#div4").show().fadeIn("slow");
          });
      &lt;/script&gt;
  </code></pre>
  
  <p>See the effect here <a href="http://jsbin.com/umode4/edit" rel="noreferrer">http://jsbin.com/umode4/edit</a></p>