I made an leafpad openstreetmap with marker and popups.
I now want to change a picture displayed in another <div id="plot"> on that website depending on which marker clicked. For updating the div i thought of using jquery. My problem is now to get the content(image url) of the array when I click on a marker...
I would appreciate any help.
function add_marker() {
var points = [
["P1", 51.57186, 11.8517, '<img src="img/1.JPG" alt="" width="350px">'],
["P2", 51.57886, 11.8117, '<img src="img/2.JPG" alt="" width="350px">'],
["P3", 51.57586, 11.8017, '<img src="img/3.JPG" alt="" width="350px">']
];
var marker = [];
for (var i = 0; i < points.length; i++) {
marker[i] = new L.Marker([points[i][1], points[i][2]])
marker[i].addTo(map);
marker[i].bindPopup(points[i][0]);
marker[i].on('click', onClick);
}
function onClick(e) {
$('#plot').html(points[i][3]);
};
}