Hi guys I try to add the latitude and longitude from my current location to an input.
Do you have any idea of what to do? this is my code
<input type="text" name="demo" id="demo" value="<?php echo $demo ;?>" />
<script>
document.getElementById("demo").value=latitude;
function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition);
}
else{
alert("Geolocation is not supported by this browser.");
}
}
function showPosition(position)
{
latitude.innerHTML= position.coords.latitude;
longitude.innerHTML=position.coords.longitude;
}
</script>