Clone Gravity Form with jQuery not working [RESOLVED]

Hi,

I am attempting to clone a form with jQuery to display in a pop-up. The form shows up just fine. However, clicking field labels to activate checkboxes/radios no longer works, and the submit button also fails. (Note - I’m cloning the element containing the form, so the AJAX iFrame and script tag are also coming along for the ride.)

I suspect this is because some initialise function is not running when I clone the form, or perhaps it’s because the cloned form has the same id as its parent.

Just wondering if anyone can shed any light on this before I write it off and take a different approach?

Thanks for reading :smile:

Just incase anyone else encounters this, I have solved the problem by moving the original item in the DOM rather than cloning it.

So

$("#pop-up").append($("#form").clone());

Became

$("#pop-up").append($("#form"));

There’s a bit more logic required to show the form and move it back when the pop-up is closed (previously, I was just removing the whole pop-up from the DOM when closed).

1 Like
© 2008 - 2021. Gravity Forms is a project by Rocketgenius Inc.