I'm not sure if i'm doing this correctly but I have this list of content that needs to be injected into a form generated by the plugin.
I'm using this code to determain each part of the form and place the content in the list that matches the output.
$('.vfb-page-section').each(function(){
var sectionName = $('.vfb-page-title',this).text().toLowerCase();
console.log(sectionName);
// Get the section name and make it lowercase to match the div class name.
$('.vfb-fieldType-radio',this).each(function(){
var groupID = $(this).attr('id').replace('vfbField','');
console.log(groupID);
// Get the ID number of the group of inputs.
$('input',this).each(function(){
var inputID = $(this).attr('id').replace('vfb-field-'+groupID+'-','');
console.log(inputID);
// Get the ID of the input.
var candidate = $('.cat-'+sectionName+' #'+inputID).clone();
//Build the selector to find the correct div.
console.log(candidate);
$(this).parent().before(candidate);
// The div needs to be appended to the parent of the input
});
});
});
The div on the page has something like this:
<div class="cat-sectionname" id="2">some content</div>
So far i've managed to get the first group to have it's content moved to the right input parents. But the next groupID nothing seems to be found.
What am I missing?