gpt4 book ai didi

javascript - Google 自动完成 HTMLInputElement 错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:48:28 31 4
gpt4 key购买 nike

我正在使用 Google Autocomplete 并收到此错误

InvalidValueError: not an instance of HTMLInputElement

我认为 Google 有 getElementById 用于 deprication

var input = /** @type {!HTMLInputElement} */(
document.getElementById('pac-input'));

但是我不确定它的用法。我的代码如下

var options ={
types:['(cities)'],
};

var input = document.getElementById('destination');
var autocomplete = new google.maps.places.Autocomplete(input, options);
}

google.maps.event.addDomListener(window, 'load', initialize);

最佳答案

使用 onFocus="functionName()" 在输入标签上调用 google.maps.autocomplete

关于javascript - Google 自动完成 HTMLInputElement 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34337196/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com