Fi3n1k
Fi3n1k

Reputation: 891

Google Places Autocomplete Event tab press

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

Upvotes: 3

Views: 1282

Answers (1)

Mike Becatti
Mike Becatti

Reputation: 2102

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'.

Upvotes: 1

Related Questions