Home / Documentation / Address Autocomplete / Trigger Address Autocomplete on hidden elements

Trigger Address Autocomplete on hidden elements

By default, Address Autocomplete attaches itself to form fields on the page after the initial page load which requires the form fields to be present and visible on initial page load. If your address fields are in a popup or hidden behind conditional form fields, you will need to add some custom code to trigger the address autocomplete once the fields are visible.

The below code is an example and you will need to adjust it for your specific needs. Premium users can contact support for additional help.

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

This code is listening for a change event to be fired for an element, waiting half a second so any hidden elements have a moment to become visible, then triggering the address autocomplete to attach itself to your fields.