llfflg
Last Updated: February 25, 2016
·
2.928K
· felipeelias
F6faa607e4f541da71fbf8aea6f99a7a

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();
Say Thanks
Respond