Created
January 13, 2019 17:33
-
-
Save Faizanq/fad8dc0fd7f49ed4ba66df86ba588fd2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://maps.googleapis.com/maps/api/js?libraries=places" type="text/javascript"></script> | |
<script type="text/javascript"> | |
function 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(); | |
document.getElementById('city2').value = place.name; | |
document.getElementById('cityLat').value = place.geometry.location.lat(); | |
document.getElementById('cityLng').value = place.geometry.location.lng(); | |
//alert("This function is working!"); | |
//alert(place.name); | |
// alert(place.address_components[0].long_name); | |
}); | |
} | |
google.maps.event.addDomListener(window, 'load', initialize); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment