Changing content of a popup.

I can't figure out how to change he content of a popup.
this.$.popup_name.setContent(); is not doing anything?


  • I figured it out. I did not realize my content was in a separate container from the popup.
  • edited November 2016
    To do so, you can use the following code:

    //marker creation
    var marker = L.marker([44.63, 22.65]).bindPopup('something').addTo(map);

    //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
    best dissertation writing service uk
  • can you share code here?
Sign In or Register to comment.