Prev/next buttons at the top [RESOLVED]

I am trying to add buttons to the top of the form and have this code:

$('.gform_page_footer:visible').clone().appendTo('.gf_progressbar_wrapper').closest();

and it works in the console, but when I add it to the custom javascript section it doesn’t work. Any ideas why it won’t work in the custom javascript section, but works in the console? Thanks!

The reason why your code is not working in the custom JavaScript section is that it’s being executed immediately when the page is loaded, which is before the form has been fully loaded. As a result, the code doesn’t find the elements it’s supposed to manipulate, and it fails to execute.

To make it work properly, you need to wrap your code in a “document ready” function. This function will wait for the HTML DOM to load before executing the code.

Here’s how you can do it: :point_down:

$(document).ready(function() {
  // executes when HTML-Document is loaded and DOM is ready
  $('.gform_page_footer:visible').clone().appendTo('.gf_progressbar_wrapper').closest();
});

Give it a try, and let me know how that goes! :smile:

1 Like

Thanks Faisal! That worked! I figured it was something simple I was missing.

1 Like