Post Format

Google Geocomplete (Miscellaneous)

This plugin generates an autocomplet from an input field, so that you can retrieve an address and its associated geodata from Google and fill it into input fields.

Initialize

Include libraries

https://maps.googleapis.com/maps/api/js?key=strongYOUR_API_KEY/strong&libraries=places
http://jquery.js
http://google-geocomplete.js

Create your Autocomplete Input field


Setup your fields, you can use type=”hidden” too

<input class="form-control" id="street" data-geo="street" name="" value="">
<input class="form-control" id="latitude" data-geo="latitude" name="" value="">
<input class="form-control" id="longitude" data-geo="longitude" name="" value="">

Call the plugin

    $(function() {
        $('.autocomplete').googleGeoAutocomplete({
            OPTIONS
        });
    });

Continue reading..

Leave a Reply