I’m trying to get Google Maps API to register a maps click and for some reason I can’t get it working!
map = new google.maps.Map( document.getElementById("map"), {
center: { lat: 53.3674604, lng: -1.2427984 },
zoom: 10,
zoomControl: true,
mapTypeControl: false,
fullscreenControl: false,
});
map.addListener( 'click', () => { console.log( "Hello"); })
google.maps.event.addListener( map, 'click', () => { console.log( "Hello"); });
I’ve tried adding the event both ways — I know I should only need one of these.
The exact same code is fine when added to a Marker. The exact same code with event ‘center_changed’ works fine.
For some reason it’s just ignoring the click event on the map?