NOTE: This article is 3 years or older so its information may no longer be relevant. Read on at your own discretion! Comments for this article have automatically been locked, refer to the FAQ
for more details.
Here's a bit of code that I'm using on a personal project of mine. This code uses the Google Maps Places API auto complete
feature without having to display a map. This means you get a text input box where you can start typing in Google Maps
locations and fit it into your standard HTML
There is a full places auto complete
example on Google's
pages but it only shows how to do it with a map present.
With my bit of code you turn this...
So lets look at some code.
for the API
. This is documented here
Then I add an input text field
that looks something like this...
that initialises the API
and adds a listener to the input text box
That's pretty much it! The input text box
will now allow you to start entering locations and will attempt to auto complete them for you.
to do that is below.
Hope you found this post useful...
...so please read on! I love writing articles that provide beneficial information,
tips and examples to my readers. All information on my blog is provided free of
charge and I encourage you to share it as you wish. There is a small favour I ask in return however -
engage in comments below, provide feedback, and if you see mistakes let me know.
If you want to show additional support and help me pay for web hosting and
domain name registration,
donations, no matter how small, are always welcome!
Use of any information contained in this blog post/article is subject to this disclaimer
Other posts you may like...