Skip to main content

How to create google like autocomplete textbox using jquery and php

Today topic is google like

autocomplete textbox using jquery and php

We all know that how the user interface is important for any web applications,So attractive user interface attracts more users.So using jquery ui and php we add autocomplete functionality on the textbox.


1 Step:- Create input box and add the id on the textbox,it is necessary beacuse we have to add autocomplete function on the id of the textbox


Note:- We must place all the jquery code under the below function

2 Step:- we have to must include the jquery library and jquery ui library

3 Step:- We have to add jquery ui css style sheet for autocomplete desgin

4 Step:- Now in this step we have added jquery autocomplete function on the textbox using textbox id

In autocomplete function we see multiple parameter to be passed So,we understand one by one what is the value to be passed to the parameter

(i) source :- In this variable we have to passed the source of data for the autocomplete

(ii) select : – For selecting the item

(iii) minlength : Define the min length of textbox for example , We have passed


Than autocomplete function call when textbox length is greater than or equal to 2.

5 Step :- In this step we have get request and pass response to the autocomplete function

In above code we have see that textbox value passed on the country_ajax_data.php using ajax now we have write some php code for the get the textbox value and search the textbox value in array if any match found we return the matches record,Otherwise we return 4 it’s indicates that the no matches found for the textbox entry.


6 step:- Create page country_ajax_data.php and Get the textbox value using this $_GET[‘country_name’] and find the matches and return response to the autocomplete funcion

I hope this tutorial helpful for you,Please share this post in social media

Recomended Tutorial

One thought to “How to create google like autocomplete textbox using jquery and php”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.