Google maps search box outside map

前端 未结 2 1422
面向向阳花
面向向阳花 2021-01-31 22:09

I\'m playing with the Google Maps API, and I\'ve inserted a search-form with autocomplete. The problem is that the input-box is stuck into the map. I can\'t display it outside t

2条回答
  •  遥遥无期
    2021-01-31 22:32

    All you need here is to load the Places library. You don't even need to display a map.

    new google.maps.places.Autocomplete(
      (document.getElementById('autocomplete')), {
        types: ['geocode']
      });
    #autocomplete {
      width: 300px;
    }
    
    
    

提交回复
热议问题