删除部分Typeahead自动完成文本

时间:2015-07-27 09:56:10

标签: javascript jquery html css

我目前使用Typeahead取得了巨大成功,但是我试图将数据添加到数组中:

else

这在血腥自动完成中显示并且效果很好,但是,一旦点击,以下内容就在文本框中。

 "<i class='fa fa-facebook-square'></i> : Value 1",
 "<i class='fa fa-university'></i> : Value 2",

无论如何要避免结肠前的一切吗?但请将下拉框保留为图标?

当前Typeahead JQuery

> <i class='fa fa-facebook-square'></i> : Value 1
  

HTML

$(document).ready(function() {
// constructs the suggestion engine
var my_Suggestion_class = new Bloodhound({
  datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
  queryTokenizer: Bloodhound.tokenizers.whitespace,
  limit:40,
  local: $.map(daysOut, function(filtered_items) { return { value: filtered_items }; })
});

// kicks off the loading/processing of `local` and `prefetch`
my_Suggestion_class.initialize();
var typeahead_elem = $('.typeahead');
    typeahead_elem.typeahead({
      hint: true,
      highlight: true,
      minLength: 1
    },
    {
      // `ttAdapter` wraps the suggestion engine in an adapter that
      // is compatible with the typeahead jQuery plugin
          name: 'states',
          displayKey: '',
          source: my_Suggestion_class.ttAdapter()
    });
});

0 个答案:

没有答案
相关问题