Show certain InfoWindow in Google Map API V3 <p>I wrote the following code to display markers. There are 2 buttons which show Next or Previous Infowindow for markers. But problem is that InfoWindows are not shown using google.maps.event.trigger Can someone help me with this problem. Thank you. Here is code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta name="viewport" content="initial-scale=1.0, user-scalable=no" /&gt; &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"/&gt; &lt;title&gt;Google Maps JavaScript API v3 Example: Common Loader&lt;/title&gt; &lt;script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var infowindow; var map; var bounds; var markers = []; var markerIndex=0; function initialize() { var myLatlng = new google.maps.LatLng(41.051407, 28.991134); var myOptions = { zoom: 5, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); markers = document.getElementsByTagName("marker"); for (var i = 0; i &lt; markers.length; i++) { var latlng = new google.maps.LatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var marker = createMarker(markers[i].getAttribute("name"), latlng, markers[i].getAttribute("phone"), markers[i].getAttribute("distance")); } rebound(map); } function createMarker(name, latlng, phone, distance) { var marker = new google.maps.Marker({position: latlng, map: map}); var myHtml = "&lt;table style='width:100%;'&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;" + name + "&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;" + phone + "&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align='right'&gt;" + distance + "&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"; google.maps.event.addListener(marker, "click", function() { if (infowindow) infowindow.close(); infowindow = new google.maps.InfoWindow({content: myHtml}); infowindow.open(map, marker); }); return marker; } function rebound(mymap){ bounds = new google.maps.LatLngBounds(); for (var i = 0; i &lt; markers.length; i++) { bounds.extend(new google.maps.LatLng(parseFloat(markers[i].getAttribute("lat")),parseFloat(markers[i].getAttribute("lng")))); } mymap.fitBounds(bounds); } function showNextInfo() { if(markerIndex&lt;markers.length-1) markerIndex++; else markerIndex = 0 ; alert(markers[markerIndex].getAttribute('name')); google.maps.event.trigger(markers[markerIndex],"click"); } function showPrevInfo() { if(markerIndex&gt;0) markerIndex--; else markerIndex = markers.length-1 ; google.maps.event.trigger(markers[markerIndex],'click'); } &lt;/script&gt; &lt;/head&gt; &lt;body onload="initialize()"&gt; &lt;div id="map_canvas" style="width:400px; height:300px"&gt;&lt;/div&gt; &lt;markers&gt; &lt;marker name='Name1' lat='41.051407' lng='28.991134' phone='+902121234561' distance=''/&gt; &lt;marker name='Name2' lat='40.858746' lng='29.121666' phone='+902121234562' distance=''/&gt; &lt;marker name='Name3' lat='41.014604' lng='28.972256' phone='+902121234562' distance=''/&gt; &lt;marker name='Name4' lat='41.012386' lng='26.978350' phone='+902121234562' distance=''/&gt; &lt;/markers&gt; &lt;input type="button" onclick="showPrevInfo()" value="prev"&gt;&amp;nbsp;&lt;input type="button" onclick="showNextInfo()" value="next"&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>