title: How can I hide/show a div-container in JavaScript?
body: <p>I'm trying to use the <code>toggleClass</code> method for hiding/showing a div-container by clicking a button. Therefore I use jQuery. It works when the class <code>.hide</code> is set to <code>visibility: hidden</code>. </p>
  
  <p>However I want to make the div container <code>.aufklapp-container</code> visible when I'm clicking the button. For CSS I tried this:</p>
  
  <pre><code>.table { visibility: hidden } 
  .hide { visibility: visible }
  </code></pre>
  
  <p>However the div-container doesn't change to visible. It stays hidden. Help me please, I don't get it.</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() {
    $(".aufklapp-button").click(function() {
      $(".aufklapp-container").toggleClass("hide");
    });
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.aufklapp-button {
    font-family: 'Segoe UI', sans-serif;
    font-weight: bold;
    font-size: 30pt;
    text-align: center;
    color: white;
    background: #7F868D;
    padding: 5px 30px 10px 30px;
    width: 60%;
    border: none;
    border-radius: 35px;
    cursor: pointer;
  }
  
  .table {
    font-family: 'Segoe UI', sans-serif;
    font-size: 15pt;
    text-align: left;
    width: 60%;
    padding: 10px 30px 20px 40px;
    border-color: #8D0011;
    border-width: 2px;
    border-style: solid;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    background: white;
    visibility: hidden;
  }
  
  .table td {
    padding: 7px 20px 7px 20px;
  }
  
  .table td:nth-child(2) {
    width: 45%;
  }
  
  .hide {
    visibility: visible;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div id="container-button"&gt;
    &lt;input class="aufklapp-button" type="button" value="Platzhalter für Kategorie"&gt;&lt;/input&gt;
    &lt;div class="aufklapp-container"&gt;
      &lt;table class="table"&gt;
        &lt;tbody&gt;
          &lt;tr&gt;
            &lt;td&gt;&lt;/td&gt;
            &lt;td&gt;Zielerreichung in %&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td&gt;Kriterium 1&lt;/td&gt;
            &lt;td&gt;Regler&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td&gt;Kriterium 2&lt;/td&gt;
            &lt;td&gt;Regler&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td&gt;Kriterium 3&lt;/td&gt;
            &lt;td&gt;Regler&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td&gt;Kriterium 4&lt;/td&gt;
            &lt;td&gt;Regler&lt;/td&gt;
          &lt;/tr&gt;
        &lt;/tbody&gt;
      &lt;/table&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>