0
How do I remove all info.window in google maps.
Most examples give the following way:
var infowindow = null;
incia
se clicar
if(infowindow){
infowindow.close();
}
My code is like this:
<script>
var infowindow = null;
//Rest of the google maps code...
map.data.addListener('click', function(event) {
if(infowindow){
infowindow.close();
}
var infoWindow = new google.maps.InfoWindow();
var iwContent = 'FOI';
infoWindow.setContent(iwContent);
var lat = event.latLng.lat();
var lng = event.latLng.lng();
infoWindow.setPosition(new google.maps.LatLng(lat,lng));
infoWindow.open(map);
});
How do I correct? because it only returns to variable NULL ...