js实用表单模糊搜索和自动提示插件 A Tiny and blazing-fast fuzzy search in JavaScript


			      

			horsey(input, {

			  suggestions: ['banana', 'apple', 'orange']

			});

			      

			    
Being lazy...

			      

			horsey(input, {

			  suggestions: function (done) {

			    setTimeout(function () {

			      done(['banana', 'apple', 'orange']);

			    }, 2000);

			  }

			});

			      

			    

			      

			horsey(input, {

			  suggestions: [

			    { value: 'banana', text: 'Bananas from Amazon Rainforest' },

			    { value: 'apple', text: 'Red apples from New Zealand' },

			    { value: 'orange', text: 'Oranges from Moscow' },

			    { value: 'lemon', text: 'Juicy lemons from Amalfitan Coast' }

			  ]

			});

			      

			    

			      

			horsey(input, {

			  suggestions: [

			    { value: 'banana', text: 'Bananas from Amazon Rainforest' },

			    { value: 'apple', text: 'Red apples from New Zealand' },

			    { value: 'orange', text: 'Oranges from Moscow' },

			    { value: 'lemon', text: 'Juicy lemons from Amalfitan Coast' }

			  ],

			  render: function (li, suggestion) {

			    var image = '<img class="autofruit" src="img/fruits/' + suggestion.value + '.png" /> ';

			    li.innerHTML = image + suggestion.text;

			  }

			});