Javascript Not Working
-
I’m an amateur when it comes to this, so I’m having trouble understanding how to patch this issue.
I have this JS code:
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"; } }); }
Which I have been trying to add to an individual page using the Scripts & Styles Plug In. It does not work at all. (The buttons do nothing upon click). I have tried other, very simple strings, to test. No JS appears to work.
I’ve tried adding a document ready string within the page, no success. I have also tried making sure jquery is enqueued by using the jquery enqueue option on the scripts & styles home plug in page.
My concern is that all the scripts involved with the theme we have are causing this upset. Please advise.
The page I need help with: [log in to see the link]
- The topic ‘Javascript Not Working’ is closed to new replies.