简体   繁体   中英

Google search autocomplete address api - search address only particular city

I am using google search address autocomplete api in my website. I want to search only the addresses for a particular city, like choose Mumbai city Below code is used to search only the country India

<input type="text" id="address">

<script type="text/javascript">
  var input = document.getElementById('address');
  var options = {componentRestrictions: {country:'ind'}};
  autocomplete = new google.maps.places.Autocomplete(input,options);
</script>

希望它的工作适合您...谢谢..

"https://jsfiddle.net/upsidown/q8XS6/"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM