Javascript,填充Google地图的结果,将API搜索结果放入下拉列表框

Javascript, populate the result of Google maps places API search results into Dropdown list box

帮我把这个页面的结果保存到Select/使用Javascript的下拉列表框。

https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-hotelsearch

谢谢

使用 JAVASCRIPT + HTML 代码 here:

在正文中添加:

<div id="drop-container"></div> 

修改addResult()

var div = document.querySelector("#drop-container"),
frag = document.createDocumentFragment(),
select = document.createElement("select");

function addResult(result, i) {
    frag.appendChild(select);
    div.appendChild(frag);
    select.options.add( new Option(result.name,result.name));
    select.onclick = function() {
        google.maps.event.trigger(markers[i], 'click');
    };

    //...

};