-
Notifications
You must be signed in to change notification settings - Fork 2
/
testFile.html
35 lines (32 loc) · 1.11 KB
/
testFile.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html>
<html>
<head>
<title>Place Autocomplete </title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
</head>
<body>
<div id="locationField">
<input class ="autocomplete" placeholder="Enter a city" type="text" />
</div>
<script>
var autocomplete;
function initMap() {
infoWindow = new google.maps.InfoWindow({
content: document.getElementById('info-content')
});
autocomplete = new google.maps.places.Autocomplete((document.getElementsByTagName('autocomplete')));
places = new google.maps.places.PlacesService(map);
autocomplete.addListener('place_changed', onPlaceChanged);
}
function onPlaceChanged() {
var place = autocomplete.getPlace();
if (!place.geometry) {
document.getElementsByTagName('autocomplete').placeholder = 'Enter a city';
}
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key= AIzaSyCSxUkLnOe4B5WwYeJPugVNTYssGcdzWmY &libraries=places&callback=initMap"
async defer></script>
</body>
</html>