Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML DOM Geolocation coords.latitude Property

Improve Article
Save Article
Like Article
  • Last Updated : 20 Nov, 2021
Improve Article
Save Article
Like Article

In this article, we will discuss the Geolocation latitude property. Geolocation in HTML is used to get the geographical position of a user. The getCurrentPosition() method, in this geolocation, returns an object on success.

coords.latitude: This property will return the latitude as a decimal number.

Please refer to the HTML Geolocation article for further details about the other location properties.



Return Value:- This property returns the latitude as a decimal number.

Example: The following HTML code will return the latitude.



<!DOCTYPE html>
    <meta charset="utf-8">
    <meta name="viewport" content=
    <h2 style="color:green">
        <b>Displaying location using latitude</b>
    <button onclick="getlocation()">
        Click Me
    <p id="paraID"></p>
        var variable1 = document.getElementById("paraID");
        function getlocation() {
        function showLoc(pos) {
            variable1.innerHTML = "Latitude: "
                + pos.coords.latitude;


Supported Browsers:

  • Google Chrome
  • Microsoft Edge
  • Firefox
  • Opera
  • Safari

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!