Looking to update the icons by changing the class from .fa-plus to .fa-minus for this specific menu section
<div class="accordion-menu">
<h2 class="accordion-header" id="subseccOne">
<button class="accordion-button-m" type="button" >
<i class="fa-solid fa-plus" data-bs-toggle="collapse" data-bs-target="#subsecollapseOne" aria-expanded="true" aria-controls="subsecollapseOne"></i> <a class="item-section" href="">SEGUNDO NIVEL </a>
</button>
...
<code>const icon= document.querySelectorAll(".fa-solid");
const plusIcon = document.querySelectorAll(".fa-plus");
for (i =0; i < plusIcon.length; i++){
plusIcon[i].addEventListener("click", function (){
icon.classList.remove("fa-plus");
icon.classList.add("fa-minus")
});
}
Encountering an error in the console when running the click event on the function:
menu_funcionalidad.js:29 Uncaught TypeError: Cannot read properties of undefined (reading 'remove') at HTMLElement.