title: Toggle multiple divs one at a time with 1 button using Jquery
body: <p>I have four divs which i want to toggle one at a time with a single button. I want to toggle them one after the other and not randomly. I have tried something like below.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
    $('#toggle').click(function() {
      $('#1').hide();
    });
    $('#toggle').click(function() {
      $('#2').hide();
    });
    $('#toggle').click(function() {
      $('#3').hide();
    });
    $('#toggle').click(function() {
      $('#4').hide();
    });
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.divs {
    border: 1px solid;
    height: 30px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id='1' class='divs'&gt;&lt;/div&gt;
  &lt;div id='2' class='divs'&gt;&lt;/div&gt;
  &lt;div id='3' class='divs'&gt;&lt;/div&gt;
  &lt;div id='4' class='divs'&gt;&lt;/div&gt;
  
  &lt;button id='toggle'&gt;
    toggle
  &lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>