• Resolved rhhridoy

    (@rhhridoy)


    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]

Viewing 1 replies (of 1 total)
  • Plugin Author WP Sunshine

    (@wpsunshine)

    Unfortunately I do not see a way to get this plugin working for your unique situation

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.