title: Use jQuery or JS to hide div on different dropdown selection
body: <p>When I select an option from the dropdown, a set of buttons associated with that selection appears in a div (where it should). I then click one of those buttons which causes a second div to appear (#info, green background) and content associated with the button to appear inside of the div (as intended).</p>
  
  <p><strong>My issue is this:</strong></p>
  
  <p>Once the second div has appeared, if I go back to the initial dropdown and select a different option, I want the green #info div to disappear, where it currently stays visible and contains the content associated with the last button clicked despite having selected a different dropdown option.</p>
  
  <p>I would SO appreciate any help anyone can provide! Thanks so much for taking a look. So grateful to have access to all of your smart brainz.</p>
  
  <p>Here is my <a href="https://jsfiddle.net/lcunning/xkz7rddm/" rel="nofollow noreferrer">Fiddle</a></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() {
    $("select").change(function() {
      $(this).find("option:selected").each(function() {
        if ($(this).attr("value") == "red") {
          $(".box").not(".red").hide();
          $(".red").show();
  
        } else if ($(this).attr("value") == "green") {
          $(".box").not(".green").hide();
          $(".green").show();
        } else if ($(this).attr("value") == "blue") {
          $(".box").not(".blue").hide();
          $(".blue").show();
        } else {
          $(".box").hide();
        }
      });
    }).change();
  
    $('.buttons button').click(function() {
      $('#info').empty();
      $('#info').html($("#" + $(this).data('link')).html());
    });
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.box {
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #000;
    width: 200px;
    height: 250px;
    padding: 0px;
    display: inline-block;
    float: left;
  }
  #button-column {
    text-align: center;
    padding: 0px;
  }
  button {
    font-size: 12px;
    width: 100px;
    height: 30px;
    padding: 10px;
    margin: 15px;
  }
  #info {
    width: 250px;
    height: 200px;
    float: left;
    display: inline-block;
    text-align: center;
    margin-left: 15px;
    margin-top: 30px;
  }
  #dropdown {
    width: 200px;
    text-align: center;
  }
  .box h3 {
    text-align: center;
  }
  .info {
    background-color: green;
    height: 200px;
    border: 1px solid #000;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div id="dropdown"&gt;
    &lt;h3&gt;I am a...&lt;/h3&gt;
    &lt;select&gt;
      &lt;option&gt;Select&lt;/option&gt;
      &lt;option value="green"&gt;Dinosaur&lt;/option&gt;
      &lt;option value="red"&gt;Unicorn&lt;/option&gt;
    &lt;/select&gt;
  &lt;/div&gt;
  
  &lt;div class="green box"&gt;
    &lt;h3&gt;Today I am feeling...&lt;/h3&gt;
    &lt;ul id="button-column" style="list-style: none;"&gt;
      &lt;li class="buttons"&gt;
        &lt;button data-link="content"&gt;Content&lt;/button&gt;
      &lt;/li&gt;
      &lt;li class="buttons"&gt;
        &lt;button data-link="mad"&gt;Mad&lt;/button&gt;
      &lt;/li&gt;
      &lt;li class="buttons"&gt;
        &lt;button data-link="hungry"&gt;Hungry&lt;/button&gt;
      &lt;/li&gt;
  
    &lt;/ul&gt;
  
  &lt;/div&gt;
  
  &lt;div class="red box"&gt;
    &lt;h3&gt;Today I am feeling...&lt;/h3&gt;
    &lt;ul id="button-column" style="list-style: none;"&gt;
      &lt;li class="buttons"&gt;
        &lt;button data-link="shy"&gt;Shy&lt;/button&gt;
      &lt;/li&gt;
      &lt;li class="buttons"&gt;
        &lt;button data-link="curious"&gt;Curious&lt;/button&gt;
      &lt;/li&gt;
      &lt;li class="buttons"&gt;
        &lt;button data-link="sleepy"&gt;Sleepy&lt;/button&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  &lt;div id="info"&gt;
  
  &lt;/div&gt;
  &lt;div id="hiddenDivs" style="display:none;"&gt;
    &lt;!-- Dinosaur Select --&gt;
    &lt;div id="content"&gt;
      &lt;div class="info"&gt;
        &lt;h3&gt;Laying in the sun is nice.&lt;/h3&gt; 
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div id="mad"&gt;
      &lt;div class="info"&gt;
        &lt;h3&gt;Go knock some trees over!&lt;/h3&gt; 
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div id="hungry"&gt;
      &lt;div class="info"&gt;
        &lt;h3&gt;Go make a salad!&lt;/h3&gt; 
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;!-- Unicorn Select --&gt;
    &lt;div id="shy"&gt;
      &lt;div class="info"&gt;
        &lt;h3&gt;I like to hide in the forest.&lt;/h3&gt; 
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div id="curious"&gt;
      &lt;div class="info"&gt;
        &lt;h3&gt;Wait until everyone is asleep.&lt;/h3&gt; 
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div id="sleepy"&gt;
      &lt;div class="info"&gt;
        &lt;h3&gt;Napping under a shady tree is the best.&lt;/h3&gt; 
      &lt;/div&gt;
    &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>