title: jquery function works correctly only on first click
body: <p>I have this function</p>
  
  <pre><code>$(".plusmenus1").on('click', function() {
      $('.plusmenus1 i').toggleClass("fa-plus fa-minus");
      $("#care_and_washing").toggleClass("collapsed_MB  ");
      changeHeight();
  });
  $(".plusmenus2").on('click', function() {
      $('.plusmenus2 i').toggleClass("fa-plus fa-minus");
  });
  
  $(document).ready(function() {
      changeHeight();
  });
  
  function changeHeight() {
      var divHeight = $("#care_and_washing").height() + $("#demo").height();
  
      if (!$("#care_and_washing").hasClass("collapsed_MB")) {
          $('#careheight').css('height', divHeight + 'px');
      } else {
          $('#careheight').css('height', '10px');
      }
  }
  </code></pre>
  
  <p>it works but it gets the <code>var divHeight = $("#care_and_washing").height() + $("#demo").height();</code>correctly only on the first click after that it gets the <code>var</code> without the + so it adds the <code>height</code> only of the <code>#care_and_washing</code></p>
  
  <p>HTML (I'll try to add only what's needed)</p>
  
  <pre><code>&lt;div class="plusmenus1"&gt;&lt;i data-toggle="collapse" data-target="#demo" style="float: left; position: relative; top: 3px; padding-right: 5px; color: black; font-size: 10px;" class="fa fa-plus collapsed" aria-hidden="true"&gt;&lt;/i&gt;
  &lt;p id="care_and_washing" data-toggle="collapse" data-target="#demo" class="collapsed collapsed_MB" style="font-family: 'NiveauGroteskMedium'; font-size: 11px; color: black;"&gt;Care &amp; Washing&lt;/p&gt;
  &lt;/div&gt;
  &lt;div style="cursor: default; padding-left: 13px;" id="demo" class="collapse"&gt;
  &lt;p style="font-family: Questrial, sans-serif; font-size: 10px;"&gt;• Dry Flat&lt;/p&gt;
  &lt;p style="font-family: Questrial, sans-serif; font-size: 10px;"&gt;• Do Not Bleach&lt;/p&gt;
  &lt;p style="font-family: Questrial, sans-serif; font-size: 10px;"&gt;• Tumble Dry Low&lt;/p&gt;
  &lt;p style="font-family: Questrial, sans-serif; font-size: 10px;"&gt;• Iron Low&lt;/p&gt;
  &lt;p style="font-family: Questrial, sans-serif; font-size: 10px;"&gt;• Hand Wash&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;div id="careheight" &gt;&lt;/div&gt;
  </code></pre>