Title: Toggle Not Working Outside Loop
Last modified: October 8, 2020

---

# Toggle Not Working Outside Loop

 *  [raits515](https://wordpress.org/support/users/raits515/)
 * (@raits515)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/toggle-not-working-outside-loop-2/)
 * Hey
 * I have tried replacing ‘load_dependencies’ method described in [https://wordpress.org/support/topic/toggle-not-working-outside-loop/](https://wordpress.org/support/topic/toggle-not-working-outside-loop/)
   
   But, it is still not working on product category page.
 * Hope you can help me figure out how to get toggle working outside loop.
 * Best,
 * Raido
    -  This topic was modified 5 years, 7 months ago by [raits515](https://wordpress.org/support/users/raits515/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ftoggle-not-working-outside-loop-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Thread Starter [raits515](https://wordpress.org/support/users/raits515/)
 * (@raits515)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/toggle-not-working-outside-loop-2/#post-13514881)
 * I tired this javascript that i found from w3chools.com and changed the ‘get element
   glass name by class name’ but it’s still not working.
 * function wp_customjs() {
    ?> <script> var acc = document.getElementsByClassName(“
   gs-faq__question”); 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.maxHeight) { panel.style.maxHeight = null; } else { panel.style.maxHeight
   = panel.scrollHeight + “px”; } }); } </script> <?php } add_action( ‘wp_footer’,‘
   wp_customjs’);
 * Any help?

Viewing 1 replies (of 1 total)

The topic ‘Toggle Not Working Outside Loop’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/genesis-simple-faq_7da5c5.svg)
 * [Genesis Simple FAQ](https://wordpress.org/plugins/genesis-simple-faq/)
 * [Support Threads](https://wordpress.org/support/plugin/genesis-simple-faq/)
 * [Active Topics](https://wordpress.org/support/plugin/genesis-simple-faq/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/genesis-simple-faq/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/genesis-simple-faq/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [raits515](https://wordpress.org/support/users/raits515/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/toggle-not-working-outside-loop-2/#post-13514881)
 * Status: not resolved