Q:

Change the content of map pop up real time, Leaflet js

In Leaflet, Im showing a map with pop up showing information about the selected area.
This is my code
L.geoJson(territories, {
    style: function(feature) {
          return {color: "#328CFA"};
    }
}).bindPopup(poupcontent).addTo(map);

The variable poupcontent has the data to be shown in the pop up.
I have some filtering options in my site.
Now what I need is to filter the content shown in the pop up in real time, according to the filters applied.

A:

I have found a better answer.Calling the bindpopup function inside the filter function will worked for me.ie
var territories = L.geoJson(territories, {
    style: function(feature) {
          return {color: "#328CFA"};
    }
}).addTo(map);

territories.bindPopup(poupcontent);

call territories.bindPopup(newpoupcontent); inside the filter function with the new content 

