Jquery with autocomplete trigger after selecting an element-Collection of common programming errors
First, I believe what you are referring to is jqueryUI’s autocomplete widget. The select
method fires when an autocomplete selection has been made. I’m assuming what you’re trying to do would be to display the coordinates of a geographical region chosen from the auto complete list.
you would need to do something like this:
$('#inputbox').autocomplete({
select: function(event, ui){
// code to get selection
var address = $('#inputbox').text();
//assuming your geocode is correct
geocoder.geocode( { 'address': address}, function(results, status)
{
if (status == google.maps.GeocoderStatus.OK)
{
alert(results[0].geometry.locations);
}
});
}
});
For more info, see the autocomplete documentation: http://api.jqueryui.com/autocomplete/#event-select
Originally posted 2013-11-09 19:46:24.