stefanocudini / leaflet-search

Search stuff in a Leaflet map
https://opengeo.tech/maps/leaflet-search/
MIT License
772 stars 334 forks source link

Unable to Remove an Existing Search Control #301

Closed gregoryelias closed 1 year ago

gregoryelias commented 1 year ago

Hello,

I've been having an issue removing/identifying search controls after they have been added to a map. Is it possible to remove all current search controls before adding a new one for instance?

Thanks, Gregory

stefanocudini commented 1 year ago
var controlSearch = new L.Control.Search()
...
map.removeControl(controlSearch)