こんにちは、情報ウィンドウ内のボタンに、このように試したイベントを追加しようとしています
var infoWindow = new google.maps.InfoWindow({
content: '<div></br><span class="formatText">Ubicacion del Marcador: </span>' + event.latLng.toString()
+ '</br> <input type="button" id="btnPrueba" value="prueba"/></div>'
});
google.maps.event.addListener(marker, 'click', function () {
infoWindow.open(map, this);
google.maps.event.addDomListener(document.getElementById('btnPrueba'), 'click', removeMarker);
});
function removeMarker(){
alert('it works');
}
私は何を間違っていますか?またはこれを行う別の方法ですか?ありがとう
編集
私もこのようなjqueryで試してみましたが、関数によって取得されたイベントですが、アラートは表示されません。クロムでデバッグを行うと、動作します:(
google.maps.event.addListener(marker, 'click', function () {
infoWindow.open(map, this);
$("#btnPrueba").click(function () {
alert('funciona');
});
});