您可以在现场目标类型/酒店 网址:http://think.thinkhotels.com/自动完成问题镀铬
它会自动提示你。功能工作正常。但是当您按左/右箭头键时,光标会像平常一样在所有浏览器左右移动,除了铬。
我试图在http://think.thinkhotels.com/autofill/jquery.autocomplete.js
修改代码,它有
$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
// a keypress means the input has focus
// avoids issue where input had focus before the autocomplete was applied
hasFocus = 1;
// track last key pressed
lastKeyPressCode = event.keyCode;
switch(event.keyCode) {
case KEY.UP:
event.preventDefault();
if (select.visible()) {
select.prev();
} else {
onChange(0, true);
}
break;
我加了几行代码,以便它避免了在左边的任何行动以下/右箭头是修改后的代码
$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
// a keypress means the input has focus
// avoids issue where input had focus before the autocomplete was applied
hasFocus = 1;
// track last key pressed
if(event.which ==KEY.LEFT || event.which == KEY.RIGHT) {
return true;
}
lastKeyPressCode = event.keyCode;
switch(event.keyCode) {
case KEY.UP:
event.preventDefault();
if (select.visible()) {
select.prev();
} else {
onChange(0, true);
}
break;
关键是如下
var KEY = {
UP: 38,
DOWN: 40,
DEL: 46,
TAB: 9,
RETURN: 13,
ESC: 27,
COMMA: 188,
PAGEUP: 33,
PAGEDOWN: 34,
BACKSPACE: 8,
LEFT: 37,
RIGHT: 39
};
但问题没有得到解决。 我试过返回false;此外也没有奏效。我曾尝试event.preventDefault(),也没有奏效。
任何人都可以找到,请