我正在使用一個簡單的搜索框,用戶可以在其中鍵入一個值或從下拉菜單中選擇它。現在,當您選擇菜單時,它可以正常工作,但如果按下Enter鍵,則不會執行任何操作。任何幫助表示讚賞。感謝按Enter後Jquery UI自動完成不提交
var source = [ { value: "src/devices/consoles/ps4.php",
label:"PlayStation 4"
},
{ value: "src/devices/consoles/ps4.php",
label:"PS4"
},
{ value: "src/devices/consoles/ps4.php",
label:"Sony"
},
{ value: "src/devices/consoles/xbox.php",
label:"Xbox One"
},
{ value: "src/devices/consoles/xbox.php",
label:"Microsoft"
},
{ value: "src/devices/consoles/wiu.php",
label:"Nintendo"
},
{ value: "src/devices/consoles/wiu.php",
label:"Wii U"
}
];
$("input#tags").autocomplete({
source: source,
select: function(event, ui) {
window.location.href = ui.item.value;
}
});
太謝謝你了。它完美的作品。 –
很高興我能幫到你! :) – urbz