Last Updated: February 25, 2016
·
3.859K
· 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();

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Related Tags
#javascript
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside