Wednesday 6 December 2017

Help With Wes Bos Learn Node Course

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. http://ift.tt/2AUm1e1 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;

Submitted December 06, 2017 at 02:10PM by Simbaxo

No comments:

Post a Comment