title: How to close tabs when one is active on jquery?
body: <p>Here is a tabs code when tabs don't deactived when one is active. I try to use it for another page and add deactivation for tabs when one is active, but get console error <strong>$(...).parent(...).siblings(...).hasClass(...).each is not a function</strong>.
  I rarely work with jquery, please tell me how to do it right way.</p>
  <pre><code>var acc = $('.questions_item_title');
  var accAnother = $('.page-another .questions_item_title');
  
  for (var i = 0; i &lt; acc.length; i++) {
      acc[i].addEventListener(&quot;click&quot;, function() {
          var panel = this.nextElementSibling;
          if (panel.style.maxHeight){
              panel.style.maxHeight = null;
              $(this).parent('.questions_item').removeClass('active');
          } else {
              panel.style.maxHeight = panel.scrollHeight + &quot;px&quot;;
              $(this).parent('.questions_item').addClass('active')
              for (var j = 0; j &lt; accAnother.length; j++) {
                  $(this).parent('.questions_item').siblings().hasClass('active').removeClass('active');
              };
          }
      });
  }
  
  accAnother[0].parentElement.classList.add(&quot;active&quot;);
  accAnother[0].nextElementSibling.style.maxHeight = accCredLine[0].nextElementSibling.scrollHeight + &quot;px&quot;; 
  </code></pre>