i want to add toggle class to two elements a li and a div but i can only get it to work on the div
var list = document.getElementsByClassName("list");
var acc = document.getElementsByClassName("accordion");
var i;
for (i = 0; i < acc.length; i++) {
  acc[i].addEventListener("click", function() {
    this.classList.toggle("active");
    list.classList.toggle("active");
    var panel = this.nextElementSibling;
    if (panel.style.maxHeight) {
      panel.style.maxHeight = null;
    } else {
      panel.style.maxHeight = panel.scrollHeight + "px";
    }
  });
}<ul class="collapsible popout">
    <li class="list">
        <div class="accordion">Section 1</div>
        <div class="panel">
            <p>Lorem ipsum dolor sit amet.</p>
        </div>
    </li>
    <li class="list">
        <div class="accordion">Section 2</div>
        <div class="panel">
            <p>Lorem ipsum dolor sit amet.</p>
        </div>
    </li>
    <li class="list">
        <div class="accordion">Section 3</div>
        <div class="panel">
            <p>Lorem ipsum dolor sit amet.</p>
        </div>
    </li>
</ul>i cant get seem to get both to the li class list and the div accordion to toggle active at the same time where am i going wrong sorry not very skilled when it comes to javascript
 
     
    