smeijer / leaflet-geosearch

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

Populating search input on single click event #261

Closed nuluferdmello closed 3 years ago

nuluferdmello commented 3 years ago

Hi,

Is it possible to populate the search input after clicking on a state or city on the map or on load when user location is found?

nuluferdmello commented 3 years ago

I figured it out, hence closing the query.

let input = document.querySelector( '.leaflet-control-geosearch form input' ); document .querySelector('.leaflet-control-geosearch') .classList.add('active'); //to keep the input field open when value is available input.value = value; //value is passed from feature data