Horje
setCenter: not a LatLng or LatLngLiteral with finite coordinates: in property lat: not a number Code Example
setCenter: not a LatLng or LatLngLiteral with finite coordinates: in property lat: not a number
//The error comes because you pass the value as string:
var lat = document.getElementById('lat').value;

//you need to set it as float:
var lat = parseFloat(document.getElementById('lat').value);
setCenter: not a LatLng or LatLngLiteral with finite coordinates: in property lat: not a number
70

The .value attribute of a HTMLInputElement returns the value as a string.

You have to parse the content of lat and lng with parseFloat() before passing it to the maps API

function initAutocomplete() {
    var lat = parseFloat(document.getElementById('lat').value);
    var lng = parseFloat(document.getElementById('lng').value);

    var map = new google.maps.Map(document.getElementById('map'), {
        center: {
            lat: lat,
            lng: lng
        },
        zoom: 13,
        mapTypeId: 'roadmap'
    });
}




Javascript

Related
sliding element jquery Code Example sliding element jquery Code Example
javascript count no of lines Code Example javascript count no of lines Code Example
express octet stream Code Example express octet stream Code Example
discord.js if arguments null Code Example discord.js if arguments null Code Example
[HomePage] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment> Code Example [HomePage] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment> Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10