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);
Related Posts:
- ReferenceError: google is not defined
- google map API zoom range
- Is there a way to display all my posts on a single Google Map?
- WordPress Google Maps
- Google Maps in WordPress
- Google Maps API problem – initMap()
- Location-Based Pages displaying results near customer
- ‘SiteOrigin Google Maps’ widget conflicting with ‘ProtheusThemes’
- Anyway to have google maps display multiple AND unique locations per individual posts/pages?
- Google Map is not working on the second tab of Tab Plugins
- How to pinpoint posts location with Google map v3?
- Geo Mashup Maps show only specified categories
- create dynamic google map with iframe api
- Google map API Key restrictions does not recognize website IP
- How to get input value after google maps autocomplete?
- Form behaving differently on small screens vs desktop screen
- Generate a radius search of custom post type locations
- Google Maps API in wordpress
- Implement Google Maps JS on WordPress
- Add different custom markers for different post types in Google maps API
- ACF Google Maps – Multiple Pins
- Using Custom Field in Google Map Embed Code Works in One Theme, Not Another
- Google Map Integration
- Mixed Content: The page at ‘https://www.taylortireauto.com/?s=contacts’ was loaded over HTTPS [closed]
- Google map iframe into wordpress theme [closed]
- How to handle multiple distance matrix api request in loop to reduce load and request time?
- google map Info window [closed]
- Google Map not displayed [closed]
- WordPress – Generate Longitude Latitude Map into Page
- How to do google maps with own markers, text pop-ups on specific locations with clickabkle links
- This page didn’t load Google Maps correctly. See the JavaScript console for technical details
- This page didn’t load Google Maps correctly. See the JavaScript console for technical details
- (Google Map API) Geocode was not successful for the following reason: REQUEST_DENIED
- function updateMap for Google Maps API
- This API project is not authorized to use this API. Please ensure that this API is activated in the APIs Console
- Type error: cannot convert the series to
- Eclipse: Enable autocomplete / content assist
- Autocompletion in Vim
- JSON to pandas DataFrame
- Give a value to an ng-model=”searchText” input based on list item clicked in Angular JS
- How can I change the color of a Google Maps marker?
- How do I stop Notepad++ from showing autocomplete for all words in the file
- InvalidValueError: not an instance of HTMLInputElement
- Using google API to tell how busy a place is
- Can not solve: Geocode was not successful for the following reason: OVER_QUERY_LIMIT
- Google Maps API DeletedApiProjectMapError
- Google Maps JS API v3 – Simple Multiple Marker Example
- twitter bootstrap autocomplete dropdown / combobox with Knockoutjs
- “google is not defined” when using Google Maps V3 in Firefox remotely
- Atom JavaScript Autocomplete
- ApiNotActivatedMapError for simple html page using google-places-api
- Getting “Cannot call a class as a function” in my React Project
- google my maps ~ custom map embed into wordpress
- google my maps ~ custom map embed into wordpress
- How can I implement a location based (zip code) search in WordPress?
- Auto-complete or auto-suggest from list of post titles
- Optimizing a Proximity-based Store Location Search on a Shared Web Host?
- How to query posts based on lat-lng coordinate as post meta?
- How to disable autocomplete on the wp-login.php page
- Remove extra Google Maps script
- add_filter the_content str_replace after shortcode
- ACF Relationship Field Search Filtering [closed]
- Google Maps not displaying in wordpress using Google Maps Javascript API
- Custom taxonomy only shows 0 in autocomplete for terms and “Choose from the most used tags”
- Custom Post Type with Input fields to seperate table on database.
- Can I disable the auto complete?
- I have geocoded posts with latitude longitude – How to search by radius?
- jQuery Autocomplete in WordPress
- Integrating Google Maps with custom marker and hover?
- How would implement StackExchange ‘Questions with similar titles’ for the FAQ on my wordpress site
- How can I run shortcode after click with ajax
- Autocomplete for taxonomy input boxes on a front end form
- Post queries by latitude and longitude
- Create multiple Search functions for posts / custom post types and everything
- jQuery Autocomplete not working with wp_localize_script
- jQuery UI Autocomplete showing all results
- Integrating PHP into Javascript to display map markers with Google API
- Dynamic User State & City selection
- Geocoding an Exploded Custom Field Array
- Adding session variable and/or cookie based on user-selected input
- WordPress Google Maps in Custom Theme
- Take excerpt of the content of the post and send it as the title to create new post
- Google Maps and Yandex Maps doesn’t work correctly
- Show posts on a Google Map
- Travel Blog Plugins
- Autoprediction / Autocomplete Search with Meta Keys
- How can I automatically attach posts to a map?
- Run a Parallel PHP Application with WordPress
- How to get a Google maps SQL->XML->map marker tutorial to work in WordPress
- Append Auto Suggest list to specific html tag?
- AJAX in WordPress, sending coords data to MySQL and show after into map
- Custom Post for Locating by Google Maps API
- Locate authors on Google map version 3
- Allow AJAX call to other roles than admin
- Problem Building a Simple Google Maps Plugin
- How to add autocomplete to custom taxonomy for CPT
- Google Map iframe in a tab issue
- Putting PHP variables into javascript [duplicate]
- Where does WordPress store plugin (enabled/disabled) status for multisite?
- Internationalization autocomplete JS variable