Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Maps infobox Content "Undefined" Error
    text
    copied!<p>I am trying to add infobox for Google map markers using the Google Maps Utility Plugin (InfoBox). I am facing problem defining the value of content. All that I get is an "Undefined" instead on actual text. </p> <p>Please help me find the problem. Thanks.</p> <pre><code>&lt;script&gt; var addressArray = ['Beatrice, US', '1790 Inman Valley', 'Connaught Place, New Delhi']; var userInfox = ['My Name', 'Shannell ', 'XtraWize']; var geocoder = new google.maps.Geocoder(); var markerBounds = new google.maps.LatLngBounds(); function mapInit() { var originLat = '54'; var originLong = '-2'; var latlng = new google.maps.LatLng(originLat, originLong); var mapOptions = { zoom: 2, center: latlng, navigationControl: true, mapTypeControl: false, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); addMarkers(); // add the markers and info windows to the map } function addMarkers() { for (var i = 0; i &lt; addressArray.length; i++) { geocoder.geocode( { 'address': addressArray[i] }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); markerBounds.extend(results[0].geometry.location); map.fitBounds(markerBounds); var boxText = document.createElement('div'); boxText.style.cssText = 'border: 1px solid black; background: #DDD; padding: 5px;'; boxText.innerHTML = '&lt;bold&gt;'+ userInfox[i] +' &amp;mdash; Random Text&lt;/bold&gt;'; var boxOptions = { content: boxText, disableAutoPan: false, maxWidth: 0, pixelOffset: new google.maps.Size(-140, 0), zIndex: null, boxStyle: { background: 'url(tipbox.gif) no-repeat', opacity: 0.75, width: '280px' }, closeBoxMargin: '2px 2px 2px 2px', closeBoxURL: 'http://www.google.com/intl/en_us/mapfiles/close.gif', infoBoxClearance: new google.maps.Size(1, 1), isHidden: false, pane: 'floatPane', enableEventPropagation: false }; var ib = new InfoBox(boxOptions); google.maps.event.addListener(marker, 'click', function (e) { ib.open(map, this); }); } }); } } google.maps.event.addDomListener(window, 'load', mapInit); &lt;/script&gt; </code></pre> <p>In the code above at userInfox[I], the value of i is "3" for all markers. Not sure why?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload