Reputation: 3578
Trying to get Autocomplete working. Set up a test page, just HTML and JS, but still getting the "this.setValues is not a function" error. Here's the code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<input type="text" id="place">
<script src="https://maps.googleapis.com/maps/api/js?key=API-KEY&libraries=places"></script>
<script>
var place = document.querySelector('#place');
console.log(place);
var dropdown = google.maps.places.Autocomplete(place);
</script>
</body>
</html>
Upvotes: 0
Views: 932
Reputation: 910
Hi NotoriousWebmaster,
I believe that the problem is that you didn't use the "new" keyword when defining the dropdown variable. Try this: var dropdown = new google.maps.places.Autocomplete(place);
Upvotes: 3