Title: Javascript Not Working
Last modified: August 11, 2022

---

# Javascript Not Working

 *  [mkp23](https://wordpress.org/support/users/mkp23/)
 * (@mkp23)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/javascript-not-working-34/)
 * 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 3 years, 9 months ago by [mkp23](https://wordpress.org/support/users/mkp23/).
    -  This topic was modified 3 years, 9 months ago by [mkp23](https://wordpress.org/support/users/mkp23/).

The topic ‘Javascript Not Working’ is closed to new replies.

 * ![](https://ps.w.org/insert-headers-and-footers/assets/icon-256x256.png?rev=2758516)
 * [WPCode - Insert Headers and Footers + Custom Code Snippets - WordPress Code Manager](https://wordpress.org/plugins/insert-headers-and-footers/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-headers-and-footers/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-headers-and-footers/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-headers-and-footers/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-headers-and-footers/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-headers-and-footers/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 0 replies
 * 0 participants
 * Last reply from: [mkp23](https://wordpress.org/support/users/mkp23/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/javascript-not-working-34/)
 * Status: not resolved