私は google.maps.places.Autocomplete を使用しています。都市をオートコンプリートしたいのですが、オートコンプリートの結果を Google ドキュメントのように 1 つだけでなく、複数の都市に制限します。
これは私が持っているものです
<script src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places" type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
var input = document.getElementById('searchTextField');
/* restrict to multiple cities? */
var options = {
types: ['(cities)'],
componentRestrictions: {country: "us", "fr"}
};
var autocomplete = new google.maps.places.Autocomplete(input, options);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<div>
<input id="searchTextField" type="text" size="50" placeholder="Enter a location" autocomplete="on">
</div>