I'm trying to call a function from an InfoWindows in the Google Maps API, but it shows me the following error:
(index): 1 Uncaught ReferenceError: ir is not defined at HTMLButtonElement.onclick ((index): 1)
It seems that the ir()
function is not defined.
This is my code:
addMarker(position,map,title){
var marker = new google.maps.Marker({
position,
map,
title
});
var infoWindow = new google.maps.InfoWindow({
content:" "
});
marker.addListener('click',function(){
infoWindow.setContent('<h1> '+ title +'</h1>' +
'<button class="mapaboton" onclick="ir()">Ver Detalles</button>');
infoWindow.open(map,marker);
});
}
Function ir()
which I do have defined:
ir(){
console.log("vamos");
}
At the moment of clicking the button that I believe in the infowindows
it shows me the error. I was investigating and I can not find the answer.
Basically what I try to do is this