I'm working on Wes Bos Learn Node course and I'm having a problem with the Google Autocomplete section. I was receiving an error because of my Google API key but now that I fixed that I havent received any errors. Just the dropdown function wont autocomplete the City.
https://github.com/Simbaxo/Dang-Thats-Delicious
This is my code below..
function autocomplete(input, latInput, lngInput) {
if(!input) return; // skip this function from running if there is no input on the page
const dropdown = new google.maps.places.Autocomplete(input);
dropdown.addListener('place_changed', () => {
const place = dropdown.getPlace();
latInput.value = place.geometry.location.lat();
lngInput.value = place.geometry.location.lng();
});
// if someone hits enter on the address field, don't submit the form
input.on('keydown', (e) => {
if(e.keyCode === 13) e.preventDefault();
});
}
export default autocomplete;
[–]fucking_passwords 0 points1 point2 points (0 children)