Question

Hi I am trying to create a function where I ask the user to input the zoom value that he wants the map to zoom in but it seems that this is not working. Any advice on it ? Thanks.

 function zoomto()
 {
map.SetOptions({zoom: parseInt(prompt('zoom value'))});
 }

and here is my button

  <input type="button" id="zoomto" value="zoom" onclick="zoomto()"/>
Was it helpful?

Solution

Try this:

function zoomto() {
    map.set('zoom', parseInt(prompt('zoom value')));
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top