[Support request] Input sum not working with javascript + GP hooks

Home Forums Support [Support request] Input sum not working with javascript + GP hooks

Home Forums Support Input sum not working with javascript + GP hooks

  • This topic has 7 replies, 3 voices, and was last updated 7 years ago by Tom.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #385519
    Tyler

    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!

    #385597
    Leo
    Staff
    Customer Support

    Hi there,

    Does it work without the if condition?

    #387491
    Tyler

    Hey Leo,

    I get an error if I take away the “IF”.

    https://imgur.com/a/5l7Hc

    #387569
    Leo
    Staff
    Customer Support

    I meant the entire IF statement.

    So basically only paste the <script></script>

    #387591
    Tyler

    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/

    #387706
    Tom
    Lead Developer
    Lead Developer

    Replace this: $( document ).ready( function() {

    With this: jQuery( document ).ready( function($) {

    #388839
    Tyler

    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.

    #389148
    Tom
    Lead Developer
    Lead Developer

    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.

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