나는 자동 완성 구글 검색을 사용하고 싶지만 나는 개인적인 장소Google지도 api v3에 자동 완성 기능을 추가 할 수 있습니까?
을 소개 할이 내 장소하지만 onclick을 나던 작업 검색에 추가하는 데 사용되는 코드이었다
$(".pac-container").append('<div id="areasearch' + e + '" class="pac-item areasearch" style="display:none" onclick="clickOneAreaLocalizar(\'' + $(this).text() + '\')"><span class="pac-icon pac-icon-areas"></span><span class="pac-item-query"><span class="pac-matched"></span>' + $(this).text() + '</span> <span>Area</span></div>');
이 인을 결과 :
그리고 이것이 내가 입력에 검색을 추가하는 데 사용하는 코드입니다 :
var input = /** @type {HTMLInputElement} */(document.getElementById('searchbox'));
var searchBox = new google.maps.places.Autocomplete(/** @type {HTMLInputElement} */(input), { types: ['geocode'] });
google.maps.event.addListener(searchBox, 'place_changed', function() {
try{
var places = searchBox.getPlace();
if (places.length == 0) {
return;
}
var bounds = new google.maps.LatLngBounds();
bounds.extend(places.geometry.location);
map.fitBounds(bounds);
}catch(e){
codeAddress();
}
});
(3210)는 내가
이 결과 쿼티가 온 클릭 하나를 가지고 싶지만
누구든지 방법이 작업을 수행하는 어떤 생각이 작동하지 않습니다 무엇을 더 잘 이해 모두를위한이 예제를 만들어?
감사의 :
나는 내가 유일한 시도했습니다 생각하지 않는다 사용할 수 있습니다 도움이되기를 바랍니다 "필터"는 국가 및지도 경계에 따라 다릅니다. 실제로는 맨 아래에서 확인하십시오. https://developers.google.com/maps/d ocumentation/javascript/places-autocomplete # map_controls –
내가 한 번 읽은 것은 자동 완성에 사용자 지정 결과를 수정하거나 순서를 바꾸거나 추가 할 수 없다는 것을 읽었을 지 모르지만 나는 그것을 읽은 곳을 모른다 : ( – MrUpsidown
대신'onmousedown'을 사용하라. onclick'을 클릭하면 API에 의해 클릭이 취소됩니다 –