What is jquery Autocomplete?

Author - Sahil Bhalla

Jquery Autocomplete

Autocomplete is a function in javascript jqeury ui that suggests or finds and selects from a predefined list of values. Any type of input box i.e. input or textarea can be converted into an autocomplete. Basically what it does is whenever a value is entered in the textbox, autocomplete plugin searches the entries or values that match the search value and displays the list of suggested values to choose from.

Autocomplete can be used to choose previously selected values, such as entering tags for articles or entering email addresses from an address book. It can also be used to populate associated information, such as entering a city name and getting the zip code.

For example :-

<!doctype html>
<html lang="en">
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>jQuery UI Autocomplete - Default functionality</title>
 <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
 <link rel="stylesheet" href="/resources/demos/style.css">
 <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
 $( function() {
   var availableTags = [
   $( "#tags" ).autocomplete({
     source: availableTags
 } );
<div class="ui-widget">
 <label for="tags">Tags: </label>
 <input id="tags">

In this example when a user enters a value inside input box, it displays the list to choose from. The list is an array predefined (available tags is an example of that array).

There are some functions available that that we can use to customize the autocomplete search box.

for example :-

=> change()
Triggered when the field is blurred, if the value has changed.
$( "#tags" ).autocomplete({
     source: availableTags,
     Change: function(){

=> select()
Triggered when an item is selected from the menu.

$( "#tags" ).autocomplete({
     source: availableTags,
     Change: function(){
Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

2 responses on “What is jquery Autocomplete?

  1. […] Carousal, Tooltip, etc. But bootstrap does not have a component that allows filtering. However, jQuery be used to filter/search for […]

  2. […] have added a devextreme button at the bottom of the popup by using the jquery. Upon the click of the Clear button, all the checkboxes of the popup get cleared but the user has […]

Leave a Reply

Your email address will not be published.