Address suggestion is not showing on repeater field

[ad_1]

Hello sir. i am working with forminator form builder with repeater input field. and i have created a js code to add class automatically to all repeated input that i want to have address suggestions, The class is added but the address suggestion is only showing to the first field only.

// Function to add class to repeated address fields within #forminator-module-22016 #group-1
function addClassToRepeatedItems() {
const repeatedItems = document.querySelectorAll('#forminator-module-22016 #group-1 .forminator-input[name^="text-"]');
repeatedItems.forEach(item => {
// Add the custom class to all address input fields
item.classList.add('address_auto_suggestions_forminator');
});
}

// Call the function initially to add the class to existing fields
addClassToRepeatedItems();

// Listen for the addition of new repeater items within #forminator-module-22016 #group-1
document.addEventListener('click', function(event) {
if (event.target.closest('#forminator-module-22016 #group-1 .forminator-repeater-add')) {
// Delay to allow the new repeater item to be added to the DOM
setTimeout(() => {
addClassToRepeatedItems();
}, 100);
}
});

// Trigger Address Autocomplete when the class is added
jQuery(document).on('change', '.address_auto_suggestions_forminator', function() {
setTimeout(function() {
wps_aa(); // Trigger the autocomplete for the plugin
}, 500);
});

and i have used this function as well

jQuery( '#element' ).on( 'change' , function () {
setTimeout( 'wps_aa', 500 );
} );

But still no luck. can you help me ?

The page I need help with: [log in to see the link]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer