Last Updated: February 25, 2016
·
3.653K
· felipeelias

Simple jQuery for Google Maps autocomplete

This widget creates an autocomplete using with Google maps API:

$.widget('autocomplete.location', {
  options: {
    types: ['(cities)']
  },

  _create: function() {
    this.autocomplete = new google.maps.places.Autocomplete(this.element.get(0), this.options);
  }
});

Usage:

$('#cities_input').location();