I have 2 Caldera forms on a single page and I have this snippet of jQuery used to manipulate some of the markup.
$('.ss-form-fields').prependTo('.caldera_forms_form');
The problem is that both forms have the .ss-form-fields element and the result is that I'm getting elements duplicated.
So I tried this;
$(".caldera-grid").each(function(){
$('.ss-form-fields').prependTo('.caldera_forms_form');
});
.caldera-grid being a class at the top of the form markup.
Should this have worked (because it didn't) or am I doing it all wrong?
EDIT
The purpose of the .prependTo was to bring the .ss-form-fields to the top of the markup so that I could use child selectors in css as I couldn't get them to work otherwise. Without the prepend the markup looked like this;
With the prepend I could make the markup look like this;
If there is a better way of achieving a similar result i would love to hear about it.