0

It is possible to disable the Geosearch Esri controls in leaflet after the first geocode search? When I run Chrome console and I select the search geocode icon this is the code:

<input class="geocoder-control-input leaflet-bar">

I have tried to disable it using

$('.geocoder-control-input leaflet-bar').attr('disabled', true);

but it doesn't work.

3
  • By "disabled" you mean just like "grayed out" so you cannot click on the button, or is removing the search button from the map an acceptable solution?
    – GavinR
    Feb 5, 2016 at 20:59
  • The first option so when you click on search button nothing happens.
    – user19566
    Feb 6, 2016 at 10:27
  • Can u give a screen Capture !
    – Spring
    Feb 6, 2016 at 10:59

1 Answer 1

2

i think the fact that we currently define an anonymous function to dicate what happens when users click on the control is why L.domEvent.removeListener can't be used to 'disable' it later programmatically from within a client app (more info here).

it sounded like a pretty good idea to me, so i went ahead and submitted a pull request to add wrappers to esri leaflet geocoder to conveniently disable() and enable() the control in our next release.

ps: there's no need to tag your questions with unrelated APIs (like Open Layers and Google maps)

2
  • now that's what I call service Feb 9, 2016 at 22:53
  • next time i'm just going to stub out an issue and assign you @Stephen Lead ;) Feb 9, 2016 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.