leaflet open specific marker popup on button click
问题 I'm trying to open a specific marker's popup on some event(say, button click). In order to do so I add an id property to a marker and store all markers in an array. But for some reason, the id property of a marker inside of an array is undefined when I try to access it. var map = L.map('map').setView([51.505, -0.09], 13); var markers = []; var marker = L.marker([51.5, -0.09]); marker["id"]="0"; marker.bindPopup('!'); marker.addTo(map); markers.push(marker); openPopupById("0"); function