Reputation: 2762
I am having hidden input for google maps format such as:
id = SearchedLattitude with the value 45.719997
When I tried to get the values
var myLat =$('#SearchedLattitude').val();
But the results myLat is not consistent, If I set my browser in french default language then i get 45,719997 ( with the ,) in english I get 45.719997 (with the .)
It make my code fails because I use those values for google map api, it takes only english format number style for the position property
var marker = new google.maps.Marker({
position: lat and lon numbers here,
map: map,
title: 'Home'
});
How can i make it work cross countries and localisations ?
Thanks for your helps
Upvotes: 0
Views: 39
Reputation: 2306
you can just do a replace:
myLat = myLat.replace(/,/g, '.');
this will replace all ,
with .
Upvotes: 1