I want to zoom to the inserted coordinates in open layer 3

Html code
<input id="lon" type="number" > <input id="lat" type="number" > <button id="GoTo" onclick="GoTo()"> Zoom to</button>

The Javascript
` function GoTo() {

 var lat = document.getElementById("lat").value;
  var lon = document.getElementById("lon").value;
 map.getView().setCenter(lon,lat);
 map.getView().setZoom(9);

}`