How to update a popup content from its marker?
_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);
I suppose you want the content to be changed after some event occured, like mouseover, contextmenu, or anything else.
To do so, you can use the following code:
//marker creation
var marker = L.marker([44.63, 22.65]).bindPopup('something').addTo(map);
marker.openPopup();
//changing the content on mouseover
marker.on('mouseover', function(){
marker._popup.setContent('something else')
});
As you can see, you can acccess the popup for the desired marker using marker._popup method, and then use setContent method to change the text inside it.
popup.setContent method reference
Here's some code on Plunker demonstrating this: http://plnkr.co/edit/vjS495QPXiJpKalrNpvo?p=preview
Might be to late to reply, but for others, I think the best ways is here
http://jsfiddle.net/cPTQF/
$('button').click(function() {
// Update the contents of the popup
$(popup._contentNode).html('The new content is much longer so the popup should update how it looks.');
// Calling _updateLayout to the popup resizes to the new content
popup._updateLayout();
// Calling _updatePosition so the popup is centered.
popup._updatePosition();
return false;
});