I have an input select (or select box, whatever), with some values, examples: 72, 73, 74... Where each value is an area on a map. I need that value for each option selected, so as to zoom in on the map in the respective area of that value. I tried the following code:
$("#numSearch").on('change', function(e) {
var value = $(this).find(':selected').val();
//var boundArea = value.target;
//map.fitBounds(boundArea.getBounds());
alert(value);
});
Where $("#numSearch") select's id.
The result is the select's values (72, 73, 74...) as a string type.
And this:
//var boundArea = value.target;
//map.fitBounds(boundArea.getBounds());
Doesn't work :(
Can somebody help me zoom in on a selected area according to the value selected in the select???
The complete code is here:
https://github.com/eltonsantos/leaflet-tests/blob/master/teste3/index.html
and the json is here:
https://raw.githubusercontent.com/eltonsantos/leaflet-tests/master/teste3/js/geoSetoresComerciais.js
I just want get value came to selectbox (I have it) and zoom on map according value choosed.