Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Autocomplete HTMLInputElement error

I am using Google Autocomplete and am getting this error

InvalidValueError: not an instance of HTMLInputElement

I think Google has getElementById for deprication

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

However i'm unsure on it's usage. My code below

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);
like image 455
ottz0 Avatar asked Dec 17 '15 14:12

ottz0


1 Answers

Use onFocus="functionName()" which calls google.maps.autocomplete on input tag.

like image 179
Guneet Singh Avatar answered Oct 17 '22 21:10

Guneet Singh