"use strict"; var toggler = document.getElementsByClassName("rotate"); var i; for (i = 0; i < toggler.length; i++) { toggler[i].addEventListener("click", function () { this.parentElement.querySelector(".nested").classList.toggle("active"); this.classList.toggle("down"); }); }