• Resolved paul8998

    (@paul8998)


    Dear Customer Support,

    We use HFCM plugin and it works well. But there is an issue with Javascript code. If I write a simple code it works fine, but if I try to write a code with selectors (like query selector or get element by ID) in some cases the code doesn’t work even though it was checked in the console. How is it possible to solve the issue?

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author 99robots

    (@99robots)

    Hi @paul8998 – Thank you for contacting us. We think the issue is in your JavaScript code. To be specific, we think your selected id/class/tag on querySelector must be loaded before your JavaScript code executes.

    Here’s a possible solution to your problem:
    1. Make sure location of your code selected as footer.
    2. a. If you are running JQuery put your code inside following function. Also make sure JQuery library is loaded before your custom code loads.

    $( document ).ready(function() {
        // Your code goes here..
    });

    Or

    2. b. If you are running vanilla JavaScript then use the following function.

    document.addEventListener("DOMContentLoaded", function() {
      // Your code goes here..
    });

    Please let us know if you need anything else.

    Thanks

    Plugin Support 99robotsteam

    (@99robotsteam)

    We have not received a reply from you for over a couple of weeks, therefore we will be closing this ticket. Please create a new one if you require any additional help.

    Thank You,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Code doesn’t work’ is closed to new replies.