How to customize Bootstrap typeahead layout/function for more than just text?

后端 未结 3 1970
囚心锁ツ
囚心锁ツ 2021-01-31 11:39

I\'m working on a search functionality for my website and I\'m using Bootstrap\'s typeahead to show the results. So far so good. But what I want is to extend the function so tha

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-31 12:30

    Use the highlighter method:

    $('.typeahead').typeahead({
        highlighter: function(item){
            return "
    .......
    "; } });

    Method used to highlight autocomplete results. Accepts a single argument item and has the scope of the typeahead instance. Should return html.

提交回复
热议问题