Site logo

Archived topic

How to Call a Javascript Function Placed in wp_footer hook?

3 replies · Started by LaToya on March 15, 2016

Viewing posts 1–4 of 4

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.

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

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.

Glad you figured it out :)

This archived topic is closed to new replies.