Leaflet – How to Update a Popup Content from its Marker

leafletpopup

I created a popup with Leaflet doing so:

marker.bindPopup(content).openPopup();

How can I update the content value afterwards?

I suppose to do it from the marker, something like this:

marker.updatePopup(newContent);

Best Answer

_popup has an underscore in front of it to indicate that it's a private / member instance, and should not be accessed directly. The correct API is Layer.setPopupContent(). e.g. marker.setPopupContent(newContent);