Google 地图自动完成的“place_changed"以外的事件 [英] Events other than 'place_changed' for Google Maps Autocomplete
问题描述
我有一个应用当前在 place_changed 上正确触发.
I have an app that currently fires correctly on place_changed.
但是,当用户选择自动完成条目时,以及当他们在没有自动完成帮助的情况下自行输入文本时,我希望分支搜索的行为有所不同.
However, I want to branch search to behave differently when a user has selected an autocomplete entry, and when they have entered text on their own without the assistance of autocomplete.
我应该使用什么样的事件监听器来区分?我找不到有关 Google 地图自动完成的其他事件的任何文档.
What kind of event listener should I use to make the distinction? I cannot find any documentation on other events for Google Maps Autocomplete.
我现在拥有的:
var gmaps = new google.maps.places.Autocomplete($("#searchproperties").get(0),
{ types: ['geocode'], componentRestrictions: {country: 'us'} });
google.maps.event.addListener(gmaps, 'place_changed', function () {
//FIRE SEARCH
});
推荐答案
Google Maps Javascript API v3 中只有一个记录在 google.maps.places.Autocomplete 类,place_changed
There is only one documented event in the Google Maps Javascript API v3 for the google.maps.places.Autocomplete class, place_changed
您可以向其中添加标准 HTML 事件侦听器(不确定这是否会影响自动完成功能).
You can add standard HTML event listeners to it (not sure if that will affect the Autocomplete functionality).
这篇关于Google 地图自动完成的“place_changed"以外的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!