let title = document.querySelectorAll(".title");
let arrow1 = document.querySelectorAll(".arrow1");
for (let i = 0; i < title.length; i++) {
title[i].addEventListener("click", function() {
arrow1[i].classList.toggle("arrow2");
let description = this.nextElementSibling;
if (description.style.display === "block") {
description.style.display = "none";
} else {
description.style.display = "block";
}
});
}
let title = document.querySelectorAll(".title"),
arrow1 = document.querySelectorAll('.arrow1');
for (let i = 0; i < title.length; i++) {
title[i].onclick = function(){
for (let i = 0; i < arrow1.length; i++) {
arrow1[i].classList.add("arrow2");
}
};
}
Работает, не?