JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp.&sensor=false&.js"></script>
<div id="map_canvas"></div>
CSS
html, body, #map_canvas {
margin:0;
height:100%;
}
JavaScript
function initialize() {
var mapOptions = {
zoom: 14,
center: new google.maps.LatLng(52.5498783, 13.425209099999961),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'),
mapOptions);
//store the original setContent-function
var fx = google.maps.InfoWindow.prototype.setContent;
//override the built-in setContent-method
google.maps.InfoWindow.prototype.setContent = function (content) {
//argument is a node
if (content.querySelector) {
//search for the address
var addr = content.querySelector('.gm-basicinfo .gm-addr');
if (addr) {
alert(addr.textContent);
}
}
//run the original setContent-method
fx.apply(this, arguments);
};
}
google.maps.event.addDomListener(window, 'load', initialize);