JSFiddle - React, Tailwind, and code Playground

by suraj mahajan

HTML

<input id="demo" type="text" autocomplete="off">

JavaScript

$('#demo').typeahead({

 

  // data source

  source: [],

 

  // how many items to display

  items: 10,
 

  // enable scrollbar

  scrollBar:false,

 

  // equalize the dropdown width

  alignWidth:true,

 

  // typeahead dropdown template

  menu:'<ul class="typeahead dropdown-menu"></ul>',

  item:'<li><a href="#"></a></li>',

 

  // The object property that is returned when an item is selected.

  valueField:'id',

 

  // The object property to match the query against and highlight in the results.

  displayField:'name',

 

  // auto select

  autoSelect:true,

 

  // callback

  onSelect:function () {

  },

 

  // ajax options

  ajax: {

    url:null,

    timeout: 300,

    method:'get',

    triggerLength: 1,

    loadingClass:null,9
    preDispatch:null,

    preProcess:null

  }

   

});