Answer the question
In order to leave comments, you need to log in
How to rebind down keypress in Javascript?
Good afternoon!
Google Place Autocomplete is connected, it intercepts pressing the down (and up) key on the keyboard.
$('body').on('keydown', function (e) {
console.log(e.which);
}
);
Answer the question
In order to leave comments, you need to log in
it turned out like this:
var input = document.getElementById('input');
new google.maps.places.Autocomplete(input);
google.maps.event.addDomListener(input,'keydown',function(e){
if (e.keyCode == 40){
console.log(e.keyCode)
}
});
You can, for example, reset the removeEventListener listener and rewrite it in your own way
There is a nice jQuery plugin with which you can override keystrokes on any jQuery.HotKeys event .
$(document).bind('keydown', 'ctrl+a', fn);
function fn() {
alert('Hello man');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question