JourneyJoker/static/frontend/js/custom-autocomplete.js

18 lines
499 B
JavaScript
Raw Normal View History

2020-01-22 17:32:13 +00:00
var input = document.getElementById('destination');
var options = {
types: ['(cities)'],
componentRestrictions: {country: 'at'},
language: language
};
autocomplete = new google.maps.places.Autocomplete(input, options);
autocomplete.setFields(['geometry']);
autocomplete.addListener('place_changed', fillInAddress);
function fillInAddress() {
// Get the place details from the autocomplete object.
var place = autocomplete.getPlace();
alert(place.geometry.location.lat());
}