Reputation: 41
Google places autocomplete dropdown is not populating any places and when I click on search i am getting this below error.
But if I do keyboard ENTER - i see the results on the map.
Everything was working fine till yesterday and nothing changed in regards to code.
(index):9 Uncaught TypeError: Cannot set property 'handled' of undefined at _.Ec (js?key=AIzaSyDiIbcf012mobkCgUHnNjqRYzNCmTDeR1g&libraries=places:48) at HTMLInputElement. (js?key=AIzaSyDiIbcf012mobkCgUHnNjqRYzNCmTDeR1g&libraries=places:49) at Object.trigger (js?key=AIzaSyDiIbcf012mobkCgUHnNjqRYzNCmTDeR1g&libraries=places:119) at HTMLButtonElement. ((index):2699) at HTMLButtonElement.dispatch (jquery.min.js:338) at HTMLButtonElement.elemData.handle (jquery.min.js:311) at HTMLButtonElement.nrWrapper ((index):9)
Upvotes: 4
Views: 842
Reputation: 1210
My search button also started failing with the same error. I think a API change somewhere between V3.31 and V3.34 made the final argument to event.trigger required instead of optional.
https://developers.google.com/maps/documentation/javascript/reference/event#event.trigger
My code looked like this:
button.click(function () {
google.maps.event.trigger(input, 'focus');
google.maps.event.trigger(input, 'keydown', {
keyCode: 13
});
});
I added an empty third argument to the focus trigger, like this:
google.maps.event.trigger(this, 'focus', {});
and everything started working again. Hope this helps anyone in a similar situation!
Upvotes: 3