change content infowindow maps v3

后端 未结 3 1936
时光说笑
时光说笑 2021-02-07 13:26

I am trying to make it possible to change the content that shows up inside a DIV that is the content of an infowindow. I have been able to change the content from Hello to YO in

3条回答
  •  有刺的猬
    2021-02-07 14:03

    you have to set the content through setContentHTML method

    var infowindow ;
    google.maps.event.addListener(drawingManager, 'overlaycomplete', function(event) {
        if (event.type == google.maps.drawing.OverlayType.MARKER) {
            //event.overlay.setTitle("Hello");
            infowindow = new google.maps.InfoWindow({
                content: '
    Hello
    ', maxWidth: 10 }); google.maps.event.addListener(event.overlay,'click',function() infowindow.open(map,event.overlay); }); }}); function updateContent(){ infowindow.setContent("YO"); }

提交回复
热议问题