[Support request] JS Script injected but not working…

Home Forums Support [Support request] JS Script injected but not working…

Home Forums Support JS Script injected but not working…

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2387378
    Sally

    Hello,

    I wanted to add an accordion to my site without adding a bulky plugin and so used https://www.w3schools.com/howto/howto_js_accordion.asp to help me and used a hook to inject the JS onto the page in question.

    Their directions use an HTML button, GP already has it’s HTML button so I just overrode the styling for the class ‘accordion’ but the script that actually gets the accordion to open and close didn’t work.

    So, I tested just using a ‘div’ instead of a button, as neither the script nor the styling mention the button and only the classes. But, I’m no further along. If I check the page source the script is there and the script works fine in the W3 sandbox just doesn’t appear to work on my site.

    The page in question is https://www.seoinmotion.com/services-local-seo-consultant/

    #2387416
    Sally

    Fixed – I was reading up on issues with JS not working on WP and a few people recommended adding the script just before the closing body tag. So I updated the location to after content via hook and it’s working now 🙂

    #2387417
    Paul

    Hi Sally,

    Please check out this too – Create Accordion “block” with GenerateBlocks
    https://www.youtube.com/watch?v=s9NN1zDus2w

    You may be interested in this as an alternative solution.

    #2387473
    David
    Staff
    Customer Support

    Glad to hear you got that working Sally!!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.