I want to be able to modify the contents of a popup on a leafletjs map. I have hundreds of markers with my popup, they are loaded into the for loop from the array.
var marker = L.marker(new L.LatLng(a[0], a[1]), { title: title }); marker.bindPopup('<img width="'+width+'" height="'+height+'" src="'+a[3]+'"/><br><div id="weather"> <button type="button" onclick="weatherload(\''+a[0]+'\',\''+a[1]+'\')">Click Me for Weather!</button></div>',{'maxWidth':'500','maxHeight':'350','minWidth':'350'}); CAMlayer.addLayer(marker);
This creates a popup with an image and a button. When the button is pressed, I want the button to disappear if it was replaced by a bootable gif. While the AJAX function requests a break for several things, once it receives data from the server, it must change the content again. I can do all this from id to div, but this breaks the redistribution of the popup that I would like to work.
myPopup._updateLayout()
can be used to make it resize, but how can I tell what myPopup is for?
I understand setContent is the right way to update a popup, but again, how do I tell which popup is active, what do I want to work on?
How to detect a marker during a popupopen
event? This looks promising, but I did not understand how to use the identifier, which set this method to change the pop-up content.
for grammar.
source share