Jquery 如何访问谷歌地图信息框内的div

Jquery 如何访问谷歌地图信息框内的div,jquery,google-maps,Jquery,Google Maps,有没有办法访问信息框中的div?以下代码适用于标准InfoWindow: content = '<div id="#map_wrapper">THIS IS A CONTENT</div>'; infowindow.setContent(content); infowindow.setPosition(cluster.getCenter()); infowindow.open(map); console.log($('#map_wrapper').html()); co

有没有办法访问信息框中的div?以下代码适用于标准InfoWindow:

content = '<div id="#map_wrapper">THIS IS A CONTENT</div>';
infowindow.setContent(content);
infowindow.setPosition(cluster.getCenter());
infowindow.open(map);
console.log($('#map_wrapper').html());
content='这是一个内容';
infowindow.setContent(content);
infowindow.setPosition(cluster.getCenter());
打开(地图);
log($('map_wrapper').html());
但在信息框中,
$(“#map_wrapper').html()
返回
null
。有没有办法访问
#map\u包装器

谢谢

[simon.cpu]

您可以使用

$(infowindow.getContent()).find('#map_wrapper')
你可以用

$(infowindow.getContent()).find('#map_wrapper')

除非在地图上打开infobox div,否则您将无法访问它。这是因为GoogleMapsAPI在infobox div未显示时将其从DOM中删除,并在触发打开时将其附加到地图上的正确位置。因此,不幸的是,如果信息框处于关闭状态,则无法访问
#map_包装器
。除非在地图上打开信息框div,否则您将无法访问它。这是因为GoogleMapsAPI在infobox div未显示时将其从DOM中删除,并在触发打开时将其附加到地图上的正确位置。因此,不幸的是,如果信息框处于关闭状态,则无法访问
#map_包装器