我使用的是bootstrap-typeahead和rails4。
我可以获得dropdown功能,但当我向上和向下按下时,我不想让选定的值填充输入。我如何实现这一点?
我尝试了一些解决方案,但它们都不起作用。How to prevent Twitter typeahead from filling in the input with the selected value?
相关代码:
$("#nav_search").typeahead({
items: 6,
source:numbers.ttAdapter(),
displayText: function(data){
// console.log(data);
return '<div><strong>'+data.username+'</strong>'+'-'+data.position+' at '+data.company+'</div>';
},
fitToElement: true,
afterSelect: function(data){
window.location.href=data.url;
}
})发布于 2017-11-29 10:43:04
我设法解决了这个问题
.on('keyup', this, function (event){
if(event.which==38 || event.which==40) $(#nav_search).val(...)}
);https://stackoverflow.com/questions/47524167
复制相似问题