Search code examples
javascriptjqueryjvectormap

How can I set the 'markerStyle' to 'selected' in jVectorMap when the page opens?


This is an example fiddle.

I am trying to have a marker already selected on the map as soon as the page loads.

is there a way to add the selected state defined in markerStyle to the markers:

var markerArray = [
    {name:'Houston', latLng:[29.761993,-95.369568]},
    {name:'New York', latLng:[40.710833,-74.002533]},
    {name:'Kansas City', latLng:[39.115145,-94.633484]}
];

Solution

  • You can use selectedMarkers options for that. For example the following snippet will make the first and the second markers to be selected on load:

    selectedMarkers: [0,1]