Google

maps JavaScript API is great library to get location dropdown suggestion. Assume, you are developing project in which you want to add location auto suggestion for site user. Its look like impossible to manage locations of all over the world. Here, Google maps API makes it pretty thing. It fetches locations from google map and set autosuggestion to control of web page. It does not require API key and little bunch of code required to do this thing.

Google Autocomplete suggest

Google Autocomplete suggest

Here is few steps involves basic autocompete functions.

Step-1

First of all, Create simple HTML page and  load jQuery and Google JavaScript Maps API in your page. Add below into <head> or at the end of <html> tag.

Step-2

Add textbox and button controls in your html page. After doing two steps your HTML file would looked as below.

Step-3

Add below code in end of <html> tag.

var _control = $('input[name="location"]')[0]; finds control having “location” name in a page and initialize autocomplete with control. make sure that you have only one control having name “location”. If you have any queries then comment is available or you can contact me at gopal@sgeek.org

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">