You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically I want to show search input text in the popup of a search marker.
new L.Control.Search({
url: 'https://nominatim.openstreetmap.org/search?format=json&q={s}',
jsonpParam: 'json_callback',
propertyName: 'display_name',
propertyLoc: ['lat', 'lon'],
marker: search_marker,
autoCollapse: false, // otherwise the search input text will not be availble to use
}).on("search:locationfound", function(e) {
search_marker.getPopup().setContent(e.text);
});
The problem is that I have to set autoCollapse to false, otherwise the text attribute of the event `search:locationfoundz will be empty.
Can verify this, been looking for ways to save the address of the searched item and up against the same problem - even grabbing the innerHTML of the JS DOM class "search-tip" doesn't work. Perhaps this is resolved in v3.0?
but, when autoCollapse == true, then showLocation sets this._input.value = ''. The solution is to
obtain a copy of this._input.value before showLocation:
Basically I want to show search input text in the popup of a search marker.
The problem is that I have to set
autoCollapse
to false, otherwise thetext
attribute of the event `search:locationfoundz will be empty.Is it intended? bug? or should I do differently?
Demo: (try to set autoCollapse to true to see the problem)
https://jsfiddle.net/ewr2y67b/6/
The text was updated successfully, but these errors were encountered: