-3

I will be really grateful if someone could assist me.

I have a GravityForms form on Wordpress and I want the radio button selected to scroll to the form that appears below.

I found that every button has a unique generated class and every form has a unique generated ID. I tried implementing different JavaScript scripts in the Insert Header and Footer plugin.

But nothing I've tried has worked, here is the form:

https://cleanexpert.co.uk/booking/?gpmpn_page=2&postcode=n145ae

Grant
  • 5,709
  • 2
  • 38
  • 50
  • 1
    Welcome to SO. Please update your question to include relevant code, as this question needs more details so that someone can actually help you. You should consider reading https://stackoverflow.com/help/how-to-ask and https://stackoverflow.com/help/minimal-reproducible-example – Howard E Feb 06 '22 at 11:08
  • Thanks, I will read these pages. Thanks for trying to help me being better part of the community. i tried with the code below in the comments and explained what is the problem, I will be very thankful if you can advice me – Blagovest Bonchev Feb 06 '22 at 11:20
  • Does this answer your question? [scroll to anchor not working on Wordpress page](https://stackoverflow.com/questions/37762144/scroll-to-anchor-not-working-on-wordpress-page) – Howard E Feb 06 '22 at 12:52

1 Answers1

0

Please try this:

    jQuery('.gfield-choice-input').on('click', function(event) {        
     var target = jQuery("#field_1_80");
       // event.preventDefault();
        jQuery('html, body').stop().animate({
            scrollTop: target.offset().top - 180
        }, 2000);
});
Roby Raju Oommen
  • 343
  • 2
  • 10
  • 1
    When I tried in Insert Header and Footer plugin, it did not worked. But I added HTML embed from elementor and put the script there. Firtsly I tried with this selector .gfield-choice-input but it locks every button and make it unclickable. – Blagovest Bonchev Feb 06 '22 at 10:43
  • 1
    Also it is not good option because some buttons does not have form below, then I tried targeting every button seperatly. I selected only the first. It is unclickable and does not select and scroll but when you click for exmaple on the second and then you try to click on the first, it scroll but does not select it, hmm... Thanks a lot for trying to help me, I really appreciate it. – Blagovest Bonchev Feb 06 '22 at 10:43
  • 1
    Now it works but starts working from the 2nd click, on first it does not work. I just removed the line with preventDefault – Blagovest Bonchev Feb 06 '22 at 11:43
  • Great! I have updated the code, hope the issue is resolved now :) – Roby Raju Oommen Feb 06 '22 at 11:46
  • No, there is no change in the behaviour and I tried remove -180, but still did not work – Blagovest Bonchev Feb 06 '22 at 15:21