jQuery Autocomplete


AutoComplete enhances user search experience by assisting user while typing the search query.. also known as Type Ahead or Predictive search.

It provides a list of possible values when a user types into an input field.
jQuery autocomplete


AutoComplete Example

For example, in a search for months of the year, if you type JU, it will suggest June and July.

Start typing a month name in the following textbox :


Code for Auto-complete search


<!DOCTYPE html>
<title>Auto complete</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
 <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> 
$(function() {
    var months = [
      "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
      source: months
<div class="ui-widget">

  <label for="month">Month Name Type-Ahead: </label>

  <input id="month">


In this example, we are using an Array of Strings as source for the AutoComplete textbox.

We can also use a URL or even data from callback function.

Any field that can receive input can be converted into Autocomplete as either an input element, select element, or textarea element.


You may also like :

jQuery Tutorials

AngularJS Tutorial

Java Tutorials

© 2016, https:. All rights reserved. On republishing this post, you must provide link to original post

You may also like...

Leave a Reply.. code can be added in <code> </code> tags