title: Why does my div only animate when i add an attribute of isopen=true but not when i change the value to false
body: <p>When I click on a button I want my div to animate. It seems only the show animation is working, but not the hide. The hide animation doesn't work at all even though the attribute values change.</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>$("#divShow").click(function() {
    $('.parent').attr('isopen', 'true');
  });
  
  $("#divHide").click(function() {
    $('.parent').attr('isopen', 'false');
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.parent {
    display: none; //hidden by default
    width: 40px;
    height: 40px;
    background: blue;
  }
  
  @keyframes show {
    50% {
      transform: scale(1.03);
    }
  }
  
  @keyframes hide {
    50% {
      transform: scale(0.97);
    }
    100% {
      opacity: 0;
      transform: scale(0.90);
    }
  }
  
  [isopen="true"] {
    display: block;
    -webkit-animation: show .3s;
    -moz-animation: show .3s;
    -ms-animation: show .3s;
    animation: show .3s;
  }
  
  [isopen="false"] {
    -webkit-animation: hide .3s;
    -moz-animation: hide .3s;
    -ms-animation: hide .3s;
    animation: hide .3s;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;button id="divShow"&gt;Show&lt;/button&gt;
  &lt;button id="divHide"&gt;Hide&lt;/button&gt;
  &lt;div class="parent"&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>