• Hey Team,

    Have a problem with the below Javascript not working to toggle accordions:

    var acc = document.getElementsByClassName(“accordion”);
    var i;
    for (i = 0; i < acc.length; i++) {
    acc[i].addEventListener(“click”, function() {
    this.classList.toggle(“active”);
    var panel = this.nextElementSibling;
    if (panel.style.display === “block”) {
    panel.style.display = “none”;
    } else {
    panel.style.display = “block”;
    }`

    • This topic was modified 2 years, 3 months ago by mkp23.
    • This topic was modified 2 years, 3 months ago by mkp23.
  • The topic ‘Javascript Not Working’ is closed to new replies.