Varaibles map
and geocoder
are not visible outside of initialize()
function. If you open console there is error written:
ReferenceError: geocoder is not defined
They should be made global like:
var map,
geocoder;
function initialize() {
geocoder = new google.maps.Geocoder();
var mapOptions = { center: new google.maps.LatLng(40.5, -75.5), zoom: 8 };
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
}
Additionaly, div
tag is not self-closing.
<div id="map-canvas"/>
should be changed to
<div id="map-canvas"></div>