I have multiple (444) popups
open on my map
.
I tried this:
$(\".leaflet-popup-close-button\").each(function (index) {
$
This is what i did to solve my problem:
var firstLayer = true;
map.eachLayer(function (layer) {
// do something with the layer
if (firstLayer) {
firstLayer = false;
} else {
map.removeLayer(layer);
}
//console.log(layer);
});
I have 3 layers, the first one is the main one which displays my map, that's why it mustn't be removed. I removed the second and the third one which are both layers with multiple popups on it.
Thanks @rafaelbiten who pointed me in the right direction (layers).