Bootstrap Typeahead重复搜索和自动完成

时间:2012-11-19 18:21:37

标签: jquery twitter-bootstrap typeahead

我正在使用bootstrap typeahead插件来搜索术语列表,并在选中时显示该术语的图像。

基本功能有效,但我有两个问题:

1。)当一个术语被搜索两次时,图像第二次不显示(假设更新者功能没有处理相同的搜索两次?)

2。)我可以制作它,以便在搜索时显示多个图像(即,当用户键入字母“a”时,所有与显示的字词相关联的图像也可见)?我不希望用户必须等到选择了单个选项。

感谢您的帮助(我是JS菜鸟,所以如果我需要进一步澄清我的问题,请告诉我们。)

var array = $('.test').data('array');
$('.typeahead').typeahead({
      items:4,
      source: array,
      updater: function(item){
         var pic = $('img[name="'+item+'"]').css('visibility','visible').css('display','inline');
         $('#search').empty().append(pic);
         return item;
      }
});

0 个答案:

没有答案