我正在使用google自動補全地方javascript返回搜索框的建議結果,我只需要顯示與輸入字符相關的城市和國家/地區(qū),但google api會提供很多我不需要的一般地方結果,所以限制結果只顯示城市和國家。我正在使用以下示例:<html><head><style type="text/css"> body { font-family: sans-serif; font-size: 14px; }</style><title>Google Maps JavaScript API v3 Example: Places Autocomplete</title><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'); var autocomplete = new google.maps.places.Autocomplete(input); } google.maps.event.addDomListener(window, 'load', initialize);</script></head><body> <div> <input id="searchTextField" type="text" size="50" placeholder="Enter a location" autocomplete="on"> </div></body></html>
如何將Google自動填充結果限制為僅城市和國家/地區(qū)
慕無忌1623718
2019-10-24 10:29:26