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
- Eclipse: Enable autocomplete / content assist
- Google Maps API DeletedApiProjectMapError
- 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
- 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
- Autocomplete for taxonomy input boxes on a front end form
- Post queries by latitude and longitude
- Adding session variable and/or cookie based on user-selected input
- Travel Blog Plugins
- How can I automatically attach posts to a map?
- AJAX in WordPress, sending coords data to MySQL and show after into map
- Custom Post for Locating by Google Maps API
- Allow AJAX call to other roles than admin
- Problem Building a Simple Google Maps Plugin
- Internationalization autocomplete JS variable
- WordPress pagination not working with search page
- I need to get an array from the wordpress database
- How to implement a Google map store locator
- Google Map Shortcode for Custom Taxonomy/Post Types
- jQuery ajax call throws an HTTP 302
- Why is on status span no search results?
- How to load WP categories into array for autocomplete?
- Integrating PHP into Javascript to display map markers with Google API – problem with wp_localize
- Autocomplete search box
- GeoMashup plugin: how to customize cluster markers / icons? [closed]
- Autocomplete or suggest from post titles inside plugin
- How do I wrap 3rd party jquery scripts so that they work in wordpress?
- custom autocomplete search
- Google map that plot’s several markers – each one with custom data
- how to display google maps with javascript
- Where is my google maps on my page? [closed]
- buddypress remove username from autocomplete
- ACF Maps admin error: “For development purposes only” even after supplying api key
- ACF google map not working [closed]
- Where to paste Google Map Snippet / JavaScript / CSS for WordPress integration
- Understanding WordPress Search
- how can i show a google map in custom post type
- Google Maps with categories
- Updating failed. The response is not a valid JSON response. specific to my browser when I include javascript in my html
- search form for custom fields
- Adding geographical information on a registration page
- ACF Map with custom styles field
- Adding External Gmap JS to WordPress
- how to disable autocomplete search on wpLink?
- create a shortcode for embedding google map in a page
- The dropdown list in autocomplete is not showing
- mutiple shortcode instance on the same page
- Where is fusion-gmap-container?
- how to auto fille conatct form 7 when user is logined
- Convert Custom Post Data to Javascript Array for Autocomplete
- Dealing with multiple Google maps API calls
- Foreach loop inside foreach loop?
- Generating a radius search on postmeta-metavalue and adding a taxonomy to query
- Add routes between multiple ACF google maps markers [closed]
- Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete
- I want to split this into two functions
- jQuery autcomplete not working
- jQuery drop down not appearing for autocomplete/autosuggest
- How to extract specific image meta for all images?
- Cannot Hide Google Map if custom field is blank
- How to implement jquery-ui autocomplete into custom fields?
- Adding a google map to a metabox, map has inline style height=0
- Elfsight Google Maps Plugin Version 2.1.0 : Location image input not found [closed]
- In WP, Google map error initMap is not a function [closed]
- Custom Backend data for map to JSON file?
- Google Map JavaScript error after migrating
- Can’t Get jQuery AutoComplete to work in WordPress (jQuery Hide/show works)