【问题标题】:What does this mean? (Google Maps API)这是什么意思? (谷歌地图 API)
【发布时间】:2016-05-18 22:57:12
【问题描述】:

我在控制台中收到此错误消息。谁能解释为什么?并且页面正在正常运行。

js?key=MyAPIKey&v=3.exp&libraries=places,drawing,geometry:32 InvalidValueError: not an instance of HTMLInputElement_.ab @ js?key=MyAPIKey&v=3.exp&libraries=places,drawing,geometry:32

【问题讨论】:

  • 没有看到相关代码,谁也说不出100%

标签: google-maps


【解决方案1】:

当我使用谷歌地图自动完成时,我也遇到了这个错误。

InvalidValueError: not an instance of `HTMLInputElement`

所以我像这样解决这个问题。

var org = document.getElementById('origin');

 new google.maps.places.Autocomplete(org, options);

【讨论】:

    【解决方案2】:

    在回调函数后添加谷歌Api CDN

    例如。

    function initMap() {
      //
    }
    <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap" async defer></script>
    

    【讨论】:

      【解决方案3】:
      InvalidValueError: not an instance of `HTMLInputElement`
      

      这意味着你没有为你的 html 输入元素设置正确的 id。 Google API 无法在您的 html 代码中找到该控件。由于输入元素的id错误。

      如果您使用textarea,那么它将不起作用,因为谷歌地图自动完成现在只支持window.HTMLInputElement(input tags)

      更多详情请查看Link

      你也可以在这里找到Google Map API的例子

      【讨论】:

      • 我用输入标签得到这个,没有文本区域。还有其他想法吗?
      猜你喜欢
      • 2022-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-29
      • 2013-08-17
      • 2011-09-04
      相关资源
      最近更新 更多