I have multiple (444) popups
open on my map
.
I tried this:
$(\".leaflet-popup-close-button\").each(function (index) {
$
For recent versions of Leaflet:
The proper way to close a popup is to use the built-in .closePopup() method:
map.closePopup();
If you have multiple layers with different popups (like in the OP's case), then you could iterate over the layers and close the popup on each layer:
map.eachLayer(function (layer) {
layer.closePopup();
});