Javascript GMAP将事件添加到标记中的链接
我有点小问题 是否可以在GMAPSv3中的标记中添加事件单击链接Javascript GMAP将事件添加到标记中的链接,javascript,jquery,google-maps,google-maps-markers,infowindow,Javascript,Jquery,Google Maps,Google Maps Markers,Infowindow,我有点小问题 是否可以在GMAPSv3中的标记中添加事件单击链接 var m = new google.maps.Marker({ map: map, animation: google.maps.Animation.DROP, position: position, html: "<a id='link'>mylink</a>", icon: '/images/repairer.png' }); gmarkers.push(m);
var m = new google.maps.Marker({
map: map,
animation: google.maps.Animation.DROP,
position: position,
html: "<a id='link'>mylink</a>",
icon: '/images/repairer.png'
});
gmarkers.push(m);
$('#link').click(function () {
alert($(this).attr('data'));
});
google.maps.event.addListener(m, 'click', function () {
info_window.setContent(this.html);
info_window.open(map, this);
});
var m=new google.maps.Marker({
地图:地图,
动画:google.maps.animation.DROP,
职位:职位,,
html:“mylink”,
图标:'/images/repair.png'
});
gmarkers.push(m);
$('#link')。单击(函数(){
警报($(this.attr('data'));
});
google.maps.event.addListener(m,'click',函数(){
info_window.setContent(this.html);
信息窗口。打开(地图,此);
});
HELP$(“#服务#中心”)。在('click',“#OpenDetailsFromMarker'+gm,函数(){alert($(this).attr('data');});不要work@user2437305尝试使用$(“#服务_中心”)。在('click','a',函数(){alert($(this).attr('data');}
$('#your_map_id').on('click', '#link',function () {
alert($(this).attr('data'));
});