In a callback javascript file that supports a Google map (referenced by the html file) I have used the following Listener code responding to the click event on a checkbox:
window.eqfeed_callback = function (results) {
...
...
google.maps.event.addDomListener(document.getElementById("cksites"), 'click', function () {
' turn on/off a layer on the map..
});
...
...
};
When inspecting the page I am reminded that “addDomListerner” should be replaced by “addEventListener()” method since the latter is now deprecated (but will still work for the foreseeable future.).
“cksites” is the name of an checkbox that turns on/off a “layer” on the Google map.
A link to update this method is provided in the inspect view. I’ve tried numerous combinations of their suggestions and cannot seem to get an updated Listener in place. I was hoping to save some time as I am not by profession a Google map programmer.
One solution proposed adding: window.addEventListener(“load”, initMap); to solve the issue but does not say where in the code this line should be located (near the intiMap line ?)
Any help with this wuold be appreciated (the organization I work with has many of these click events so I thought it best to update them if I could).
Thanks in advance.