jQuery Plugin For Adding Autocomplete To Text Input Autocomplete js - Free Download jQuery Plugin For Adding Autocomplete To Text Input - Autocomplete.js

Free Download jQuery Plugin For Adding Autocomplete To Text Input – Autocomplete.js

Posted on

This time I will share jQuery Plugin and tutorial about jQuery Plugin For Adding Autocomplete To Text Input – Autocomplete.js, hope it will help you in programming stack.

jQuery Plugin For Adding Autocomplete To Text Input Autocomplete js - Free Download jQuery Plugin For Adding Autocomplete To Text Input - Autocomplete.js
File Size: 88.6 KB
Views Total: 4549
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Yet another simple jQuery autocomplete plugin which provides a dropdown list populated with suggestions while you type something in an input field.

How to use it:

1. Load the autocomplete.css in the head, and the autocomplete.js at the bottom of the web page which has jQuery library installed.

1 <link href="autocomplete.css" rel="stylesheet" type="text/css">
2 <script src="//code.jquery.com/jquery-1.12.4.min.js"></script>
3 <script src="autocomplete.js"></script>

2. Create an empty DIV that will be served as the container for the text input.

1 <div id="demo"></div>

3. Create another empty DIV to output the selected strings.

1 <div id="message">Selection</div>

4. Create an array of words for the auto suggestions.

1 var words = ['at', 'boat', 'bear', ...];

5. Call the plugin.

1 $('#demo').autocomplete({
2   hints: words,
3   onSubmit: function(text){
4     $('#message').html('Selected: <b>' + text + '</b>');     
5   }
6 });

6. Available plugin options.

01 $('#demo').autocomplete({
02  
03   // an array of words
04   hints: [],
05  
06   // placeholder for the text input
07   placeholder: 'Search',
08  
09   // width & height
10   width: 200,
11   height: 16,
12  
13   // display a button next to the text input
14   showButton: true,
15  
16   // button text
17   buttonText: 'Search',
18  
19   // callbacks
20   onSubmit: function(text){},
21   onBlur: function(){}
22    
23 });

Changelog:

v1.0.1 (2019-09-12)

  • Bug fix input selection

This awesome jQuery plugin is developed by lorecioni. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net