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
- function updateMap for Google Maps API
- Type error: cannot convert the series to
- JSON to pandas DataFrame
- 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
- Using google API to tell how busy a place is
- ApiNotActivatedMapError for simple html page using google-places-api
- 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
- Custom Post Type with Input fields to seperate table on database.
- jQuery Autocomplete in WordPress
- Integrating Google Maps with custom marker and hover?
- Autocomplete for taxonomy input boxes on a front end form
- Post queries by latitude and longitude
- jQuery UI Autocomplete showing all results
- Dynamic User State & City selection
- Geocoding an Exploded Custom Field Array
- WordPress Google Maps in Custom Theme
- Google Maps and Yandex Maps doesn’t work correctly
- Show posts on a Google Map
- Travel Blog Plugins
- Autoprediction / Autocomplete Search with Meta Keys
- Allow AJAX call to other roles than admin
- 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?
- Google maps causing mixed content in header
- Why is on status span no search results?
- Refresh Markercluster after ajax call
- multi-vender wooCommerce ability to separate products based on zip code [closed]
- Return an array from get_terms and store as JavaScript array for search autocomplete
- PHP array to JS array to use in google map
- How to add multiple markers on the google map, at a certain meta_key and meta_value
- Add filter post_where and passing post_type argument
- This page can’t load Google Maps correctly [closed]
- Querying posts by latitude and longitude to build a Google Maps with several markers
- Anybody knows if i could upload a leaflet or openlayers3 map to wordpress webpage?
- How do I make multiple dependent input fields that use the jquery autocomplete function?
- WordPress autocomplete search with taxonomies
- Using custom post types WordPress network
- Auto-suggest to display meta-data, but not to include it upon click
- Using the loop to set locations for all posts on a single google map
- How to automatically create an index of child sites at the root url for a multisite installation?
- How to sort store location by specific category order in WP store locations
- WordPress Query for CPT that only shows posts within radius of current user’s geolocation
- how to complete order status automatically after paypal payment received
- Insert Google Maps HTML in WordPress
- jquery Autocomplete
- Back button not working after input / search submit
- Filtering markers on google map by WordPress category[SOLVED]
- Advanced Custom Fields – Google Map Won’t Render Unless Variable Dumped
- Display posts on a map
- Allow user to select location and then set cookie for location in WordPress
- Show different Google Map markers for different post_meta values
- Querying latitude and longitude into google maps correctly
- custom field meta-box with dropdown/autocomplete
- Manually cache a special, non-WP-but-using-WP page (e.g. Ajax results) with W3TC
- jQuery autocomplete: retrieving term slug when term name selected
- Tagit with json and autocomplete
- Plugin – including external javascript calling google maps
- Custom taxonomy auto suggest not working in wordpress admin
- Geolocate Custom Post Type on Save
- How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
- Search Results with googlemaps
- using jquery autocomplete in wordpress plugin
- Can’t Get jQuery AutoComplete to work in WordPress (jQuery Hide/show works)
- JQuery UI Autocomplete/Autosuggest WordPress