Take the 2-minute tour ×
var options = {
map_frame_id: "mapframe",
    map_window_id: "mapwindow",
    lat_id: "filter_lat",
    lng_id: "filter_lng",
    addr_id: "filter_address",
    lat: "37.7749295",
    lng: "-122.4194155",
    map_zoom: 13 


Right now lat and lng code are displayed in 2 different inputs with:

lat_id: "filter_lat",
lng_id: "filter_lng",

Is is possible to add a third one that contains both of the above?

I have tried getting the code with jquery straight from the inputs but autogeocomplete scripts is stopping it for some reason so I thought I would try and just update the main script.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Just add something to the autogeocomplete script like this (this would change your input on select) :

$("#yourid").val(ui.item.latitude + "," + ui.item.longitude);

to this section of the code (line 106->109)

select: function(event, ui) {
    $("#" + lat_id).val(ui.item.latitude);
    $("#" + lng_id).val(ui.item.longitude);

you could add an option for the id of the input you want to update quite simply too

Source for Autogeocomplete here


if you do not want to modify the plugin, try :

$('#filter_lat, #filter_lng').change(function() {
    $('#yourid').val($('#filter_lat').val() + "," + $('#filter_lng').val());
share|improve this answer
I've added it and it looks like this but it's not doing anything to that input...could there be a mistype? Here is the code: select: function(event, ui) { $("#" + lat_id).val(ui.item.latitude); $("#" + lng_id).val(ui.item.longitude); $("#google_maps_code").val(ui.item.latitude + "," + ui.item.longitude); }, –  Satch3000 Mar 29 '12 at 9:37
@Satch3000 worked ok for me locally - works on a select list - try moving the code down to line 139 in the setMap function and doing $("#google_maps_code").val(lat+ "," + lng); as thats called on the callback from getting the coords from google –  ManseUK Mar 29 '12 at 9:40

Your Answer


