Jvector Map how to add and get link from marker
Just because I just solved this sort of problem a different way, and I'm feeling very clever for having done so, I will post my answer.
You can store arbitrary data using jQuery.data or javascript dom dataSets. Unless you have other SVG on your page with <circle>
elements, you can iterate over all <circle>
elements and give them data from an array. The indexes will match, but you can use data-index as a safeguard.
Pretty cool. Even though this is way old, maybe this alternative will help someone.
So much coincidence, I faced the same problem yesterday only..:)
The solution I found was to create an array outside, and access it by the index in the click-function..
var markers = [
{latLng: [48.921537, -66.829834], name: "something", weburl : "/blah/foo"},
{latLng: [45.995944, -64.171143], name: "something else", weburl : "/blah/foo-else"}
];
$(function(){
$('#map1').vectorMap({
...
markers: markers,
onMarkerClick: function(event, index) {
// alter the weburl
alert(markers[index].weburl);
}
});
});