JSFiddle - React, Tailwind, and code Playground

by pramendra

HTML

<BODY>

Click Show Location button to fetch current latitude &amp; longitude: <br/>
<center>
<input type="button" value=" Show Location " onclick="javascript:showlocation()"/> </center>
<br/>
Latitude: <span id="latitude">..</span> <br>
Longitude: <span id="longitude">..</span>

<SCRIPT>function showlocation(){navigator.geolocation.getCurrentPosition(callback);}
function callback(position){document.getElementById('latitude').innerHTML=position.coords.latitude;document.getElementById('longitude').innerHTML=position.coords.longitude;}</SCRIPT>