我有以下html;
<div class="event-details-container">
<div class="event-details">
<div class="adress">My adress</div>
<div class="arranger">My arranger</div>
<div class="title">My title</div>
<div class="date">My date</div>
</div>
<div class="event-details">
<div class="adress">My adress 2</div>
<div class="arranger">My arranger 2</div>
<div class="title">My title 2</div>
<div class="date">My date 2</div>
</div>
</div>
我有以下JS:
var myMarkers = "";
$('.event-details-container .event-details').each(function (index) {
myMarkers += "{ address: " + $(this).children(".adress").text() + ", html: " + "<div style='font-siz:14px;font-weight:bold'>" + $(this).children(".title").text() + "</div>" + $(this).children(".date").text() + "<br/>" + $(this).children(".arranger").text() + "<br/>" + $(this).children(".adress").text() + "},";
});
$(".google-map").gMap({ markers: [myMarkers.slice(0, -1)],
address: "Washington DC, US",
zoom: 6
});
上面的 JS 是基于http://gmap.nurtext.de/(一个 jQuery 插件)。但是上面的代码不起作用-地图显示,但没有标记-所以我放在一起的Json“字符串”一定有问题-但是什么?