title: How do I use vanilla JavaScript to write a toggle function I wrote in JQuery?
body: <p>Was trying to get this code working for hours yesterday using JavaScript because I'd really like to get the basics down as best possible, but finally gave up and wrote it in JQuery. Would love some advice on how to write in in vanilla JS. I am just trying to use a button to show a hidden "div" so I feel like it should be simple and I'm just overlooking something:</p>
  
  <p>JQuery:</p>
  
  <pre><code>$('document').ready(function() {
      $('.aboutBtn').click(function() {
          $('#more-brian').toggleClass('hide');
      });
  })
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="row"&gt;
  
              &lt;div class="card col-sm-6"&gt;
              &lt;h5 class="card-title"&gt;Brian Davis&lt;/h5&gt;
                &lt;img class="card-img-top" src="../soccer-travel-site/img/brian-davis.jpg" alt="Brian Davis photo"&gt;
                &lt;div class="card-body"&gt;
                  &lt;p class="card-text"&gt;Brian is the founder of AO Adventures and an original host of the BarrelProof Podcast.&lt;button type="button" class="btn btn-danger aboutBtn"&gt;More About Brian&lt;/button&gt;&lt;/p&gt;
                &lt;/div&gt;
              &lt;div id="more-brian" class="hide"&gt;
                  &lt;p id="brian-para"&gt;Brian is a husband and father who is very passionate about soccer. He has been to over 50 U.S. Men's and Women's National Team games all around the world. In his spare time he is a co-host of the BarrelProof Podcast.&lt;/p&gt;
              &lt;/div&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>I tried something like this:</p>
  
  <pre><code>function toggle(id){
      var div1 = document.getElementById(id);
      if (div1.style.display == 'none') {
          div1.style.display = 'block'
      } else {
          div1.style.display = 'none'
      }
  }
  </code></pre>
  
  <p>I didn't use this with the CSS 'hide' class. But it was showing the div on page load, then hiding it with the button, and I want the opposite to happen.</p>