Answer the question
In order to leave comments, you need to log in
How to return false on autocomplete in google maps when pressing down key?
Hello!
You have to customize Google Maps to suit your needs.
Perhaps this question only applies to Javascript, not to the Maps API.
When using autocomplete, when you press the "down" key, the value from the list is substituted into the input. How to get rid of it?
...
if(e.which == 40) {
return false;
}
...
$('#id').keydown(function () { ... });
google.maps.event.addDomListener(input, 'keydown', function(e) { ... });
Answer the question
In order to leave comments, you need to log in
So:
var input = document.getElementById('input');
autocomplete = new google.maps.places.Autocomplete(input);
google.maps.event.addDomListener(city_input,'keydown',function(e){
if (e.keyCode == 40){
google.maps.event.clearInstanceListeners(input);
}
});
new google.maps.places.Autocomplete(input);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question