How do I remove all info.window in google maps.
Most examples are as follows:
var infowindow = null;
incia
se clicar
if(infowindow){
infowindow.close();
}
My code looks like this:
<script>
var infowindow = null;
// Remaining 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 fix it? because it only returns the NULL variable ...