smeijer / leaflet-geosearch

A geocoding/address-lookup library supporting various api providers.
https://smeijer.github.io/leaflet-geosearch/
MIT License
1.03k stars 273 forks source link

Reset search bar programmatically #203

Open FabioDominio opened 4 years ago

FabioDominio commented 4 years ago

Hi all,

I was wondering if it was possible (and in case how) to reset programmatically the map search bar and remove the search result marker.

The thing is, I'm using a map within a modal dialog and I need to reset its coordinates and clear the search results each time I open that dialog.

The idea is exploiting the dialog opening event to clear the map, like this:

$('#my-dialog').on('shown.bs.modal', function () { // Reset input ... // Reset map ... });

Thanks in advance!