Comments (4)
If you check the source code for that example you'll find that only the latitude and longitude values are meant to be updated on the "dragged" event. This is to demonstrate that a user may provide a correct address but the marker position may be slightly wrong initially, so they can drag to the correct position without invalidating the address.
from geocomplete.
Is it possible to get updated address data in a simple way on this event?
from geocomplete.
+1 I would like this aswell
from geocomplete.
$("#geocomplete").bind("geocode:dragged", function (event, latLng)
{
var latlng = new google.maps.LatLng(latLng.lat(), latLng.lng());
var geocoder = geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'latLng': latlng }, function (results, status)
{
if (status == google.maps.GeocoderStatus.OK)
{
if (results[0])
{
$("#geocomplete").val(results[0].formatted_address)
console.log(results[0])
$.each(results[0].address_components, function (index, data)
{
if (data.types[0] == "country")
{
$("#country").val(data.long_name)
console.log("Country =" + data.long_name)
}
if (data.types[0] == "administrative_area_level_1")
{
$("#administrative_area_level_1").val(data.long_name)
console.log("State =" + data.long_name)
}
if (data.types[0] == "administrative_area_level_2")
{
$("#administrative_area_level_2").val(data.long_name)
console.log("District=" + data.long_name)
}
if (data.types[0] == "administrative_area_level_3")
{
$("#administrative_area_level_3").val(data.long_name)
console.log("City=" + data.long_name)
}
if (data.types[0] == "country")
{
console.log("Country=" + data.long_name)
}
if (data.types[0] == "postal_code")
{
$("#postal_code").val(data.long_name)
console.log("postal_code=" + data.long_name)
}
//alert("Location: " + results[1].formatted_address);
});
}
}
});
from geocomplete.
Related Issues (20)
- Package Doesn't autocomplete all places that google.com/maps does! HOT 1
- Add place_changed function with the geocomplete plugin
- Script block missing HOT 1
- Does not working HOT 1
- Not responding if open a html with this plugin on iPhone UIWebView
- More than a single default location
- Blocking request until query length minimum is reached
- Adding custom search results to Autocomplete results
- Uncaught TypeError: this.$input.on is not a function
- Country Restriction HOT 1
- Map not display! HOT 1
- City not loaded HOT 2
- Select First result from listing after press tab
- Add postal_town HOT 1
- Get short version of State
- Problem of operation in some locations. HOT 1
- initialize map in lat lng HOT 2
- why newer places does not pop on recommendations
- Don't get all location
- the map not showing in div. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geocomplete.