1

I was wondering if there is a way to change the text of the Leaflet zoom buttons after they have been created.

I am aware that I could do the following:

document.getElementsByClassName("leaflet-control-zoom-in").innerHTML = 'text';

Or:

map.zoomControl.remove();
L.control.zoom({zoomInText: 'text'}).addTo(map);

But I was wondering if there is perhaps a more elegant way.

The docs do not mention a method but maybe I am missing something.

4

Your second method is using the standard api approach zoom control. In order to avoid removing the zoom control you can create the map with the map zoomControl option set to false and then continue with adding the customized zoom control.

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.