Google map / jquery reverse geocoding

I have a google map that takes and puts coordinates from input fields.

Everything works fine - but now I want to try and add the ability to search by address to it - (address lookup) and I can't get it to work ...

Fiddle here:

Any insight will be greatly appreciated. (and be gentle - I'm not a JS ninja :-))


source to share

3 answers

Needs a bit of cleanup, but this is basic JavaScript. I think it has what you are looking for.



@charlietfl was correct. Sometimes the violin onLoad

makes a mess of all things. My answer



You had two small problems that could be easily spotted in the browser debug console

 /* geocoder was undefined ..add following*/
 var geocoder= new google.maps.Geocoder();

   /* exixting code*/
  map = new google.maps.Map($('#map')[0], myOptions);

  /* changed variable in argument from "latLng" to "myLatLng"*/


Working demo:



All Articles