Black Friday Sale! Get up to $40 off GP Premium!Learn more

[Resolved] How to Call a Javascript Function Placed in wp_footer hook?

Home Forums Support How to Call a Javascript Function Placed in wp_footer hook?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #179527
    LaToya

    I have a javascript function that I want to call from a button I’ve placed in a form on a WordPress Page.

    I put the Javascript code in the wp_footer hook as suggested in a few other posts here (hopefully this was the right place.)

    The button is in a WordPress Page and I’ve called the function using:

    <input type="button" onclick="calcrent()" value="Calculate" class="button">

    Nothing happens when I click the button, so I’m guessing I need to change something about the way the function called? Or do I need to place something inside the Javascript itself?

    Thanks.

    #179608
    Tom
    Lead Developer
    Lead Developer

    Nothing happens at all? Any chance you can link me to the site?

    #179616
    LaToya

    So, I had been testing the page using Preview and published it just now so I could send you the link and the js worked. So now we know – the js doesn’t work unless the page/post is actually published.

    Thanks anyway. 🙂

    I love GeneratePress. Thanks for making it so easy.

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