in my popup is a spinner with class=spinner and an empty container for addon informations.

  1. I want to hide after successful ajax.
  2. I want to add some html in a container.

I tried this:


    map.on('popupopen', function(e) {
        var marker = e.popup._source;
        $.getJSON(url,function(data) {
        $(e.popup).find('container').html('same stuff')    


It doesn't work. Any ideas?




Works for me, using Leaflet 0.7.3. Note that setContent() was added sometime in Leaflet 0.7.

| improve this answer | |
  • 2
    This is the correct answer, as demonstrated by a jsfiddle example. Click the icon to display a popup; then after a one-second delay, the popup content is modified by e.popup.setContent(). – elrobis Jan 25 '16 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.