-1
我一直在尋找如何使字段搜索框,如谷歌字段搜索地圖。我找到了正確的答案here,由@MrUpsidown回答。這是由@MrUpsidown jsfiddle回答jsfiddle它完美的作品。然後我嘗試將其實施到我的項目中,但它不起作用。谷歌地圖搜索框外部地圖沒有功能
這裏我的代碼:
<!DOCTYPE html>
<html>
<head>
<title>
Search Box Map
</title>
<style>
#autocomplete {
width:300px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&key=AIzaSyB1Z4LA0_Q-qH3Sfq-vIr3lShYnIwS1KUw&libraries=places" ></script>
<script>
function initialize() {
new google.maps.places.Autocomplete(
(document.getElementById('autocomplete')), {
types: ['geocode']
});
}
initialize();
</script>
</head>
<body>
<input id="autocomplete" placeholder="Enter your address" type="text"></input>
</body>
</html>
我下面的代碼,但仍然沒有工作。我在某處失蹤了嗎?
它的作品!我真的很新使用這個谷歌地圖API。謝謝 ! –
完成接受.. –