Chrome Autofill covers Autocomplete for Google Maps API v3

后端 未结 21 1308
我在风中等你
我在风中等你 2021-02-01 00:57

I am using Google Maps Javascript v3 to setup autocomplete on an HTML input field like so:

http://imgur.com/Rm6X2FI.png - (w/out autofill)

The issue I\'m having

21条回答
  •  萌比男神i
    2021-02-01 01:28

    I tried the sample from Google's Address Finder, and got the same problem:

    Updated Answer

    With the new version of chrome, all you need is to add: autocomplete="off" to your input:

    
    

    Original Answer - Workaround

    This is the automcomplete input, which has the event: onFocus="geolocate()":

    
    

    I added this line to geolocate, to hide the autocomplete:

    function geolocate() {
        // add this line to hide the autocomplete
        $("#autocomplete").attr("autocomplete", "new-password");
    
        // other stuff
    }
    

提交回复
热议问题