Maps search box autocomplete with callback JS function?

Try this in your js file:

    function robbte_map_initialize() {
        var input = document.getElementById('searchTextField');
        var autocomplete = new google.maps.places.Autocomplete(input);
          google.maps.event.addListener(autocomplete, 'place_changed', function () {
              var place = autocomplete.getPlace();
              if (!place.geometry) {
                window.alert("Select a suggestion from the list");
                return;
              }

              document.getElementById('city2').value = place.name;
              document.getElementById('cityLat').value = place.geometry.location.lat();
              document.getElementById('cityLng').value = place.geometry.location.lng();
          });
      }

      jQuery(document).ready (robbte_map_initialize);

tech