I am new to programming so don't judge me. Trying to write code to measure length with latitude and longitude. It's showing this error:
length.html:27 Uncaught ReferenceError: area is not defined at HTMLInputElement.onclick (length.html:27)
<html>
    <head></head>
    <body>
        <script type="module">
                import LatLon from 'https://cdn.jsdelivr.net/npm/geodesy@2.2.0/latlon-spherical.min.js';
                function area()
                {
                var la1 = document.getElementById(lat1).value;
                var la2 = document.getElementById(lat2).value;
                var lo1 = document.getElementById(lon1).value;
                var lo2 = document.getElementById(lon2).value;
                const p1 = new LatLon(la1, lo1);
                const p2 = new LatLon(la2, la2);
                const d = p1.distanceTo(p2);
                    document.write('<br>Length is : ' + d);
                }
        </script>
        <form>
            First point<br>
             Latitude: 
             <input type="text" name="lat1" id="lat1"><br>
             Longitude:
            <input type="text" name="lon1" id="lon1"><br>
            Second point<br>
            Latitude<input type="text" name="lat2" id="lat2"><br>
            Longitude<input type="text" name="lon2" id="lon2"><br>
            <input type="button" value="submit" onclick="area()">
        </form>
    </body>
</html>
 
     
    