3
votes

http://jsfiddle.net/F1sn1k/rVmxz/20/

I have tried a lot of combinations but seems place_changed works only with enter press.

   var input = document.getElementById('address_guest');
   var autocomplete = new google.maps.places.Autocomplete(input); 

   google.maps.event.addListener(autocomplete, 'place_changed', function(){  
                 //Code here
   }

Everything works fine if user 1) select any result from google places autocomplete dropdown list. and 2) when typing into autocomplete textbox press enter than I did some code about result suggestions. I want the same thing like pressing enter in ... addListener to happen with something like onblur() or onchange() or any alternative with on click or tab press...

Thank you

1
jsfiddle.net/F1sn1k/rVmxz/20 try typing ex: "3200 spenar" and press ENTER and it will show Did you mean: 3200 spenard rd. I want same thing to happen with onblur - Fi3n1k

1 Answers

1
votes

I've only been able to get 'tab' to work. I have a button next to my autocomplete control that receives focus when I press tab. I added a 'setFocus' event on that control which in turn fires the autocomplete 'place_changed' event. It's not the most elegant solution but it works for 'tab'.