【发布时间】:2025-12-12 03:00:01
【问题描述】:
我正在为此苦苦挣扎。
我正在创建一个简单的搜索地图功能,但自动完成向我抛出了不那么描述性的错误:TypeError: undefined is not a function (evalating 'azG')
我正在 modal.s.shown 事件的引导模式中初始化我的地图。
这里是 Javascript:
$('#map-modal').on('shown.bs.modal', function (e) {
//picking up data attributes from the image that initialised the modal
var image = $(e.relatedTarget);
map_lat = $(image).data('lat');
map_lng = $(image).data('lng');
//passing the data to a initialise map function
initialiseModalMap(map_lat,map_lng);
//add autocomplete
var input = $('#start-point');
var options = {
types: ['geocode']
};
var autocomplete = new google.maps.places.Autocomplete(input, options);
autocomplete.bindTo('bounds', map);
google.maps.event.addListener(autocomplete, 'place_changed', function() {
console.log('changed');
});
});
但是一旦事件显示.bs.modal 被触发,我在控制台中得到以下错误:
TypeError: undefined is not a function (evaluating 'a[zG]("placeholder")')
并且永远不会执行自动完成,在自动完成代码块之前,一切都很好。
我错过了什么?
如果您需要更多信息,请尽管询问。
提前致谢!
【问题讨论】:
标签: javascript google-maps google-maps-api-3 autocomplete google-places-api