Archived topic
Input sum not working with javascript + GP hooks
7 replies · Started by Tyler on September 14, 2017
Hey Tom,
I need help, can you please tell me what I am doing wrong?
Here is the code I used:
http://jsfiddle.net/markwylde/gjz9h/
Here is the page I am working on:
http://www.muhrprofessionalbuildings.com/wp/comparison/
And an image of what my javascript looks like inside your GP hook section.

Thank you!
Hi there,
Does it work without the if condition?
I meant the entire IF statement.
So basically only paste the <script></script>
Hey Leo,
Unfortunately, it still doesn't work :(
I think I had it as only the script prior to finding a forum where Tom mentioned having that PHP in there and it worked for the customer.
https://generatepress.com/forums/topic/using-custom-javascript-in-a-page/
Replace this: $( document ).ready( function() {
With this: jQuery( document ).ready( function($) {
Hey Tom,
Thank you, it definitely did something, but it doesn't show the total value it just makes the "0" disappear.
http://www.muhrprofessionalbuildings.com/wp/comparison/
You can see it here, until I get it working I have it only set up with the first two boxes. The others are inputs for numbers.
On the final row is where I have the total and in the second column it has the sum displayed.
Hmm, I can't see why it wouldn't work. The jQuery itself makes sense and should work fine. There might be other factors at play though - plugins, HTML etc.. It's hard for me to tell unfortunately.