Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7934301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:36:26+00:00 2026-06-03T21:36:26+00:00

Am I missing something completely obvious here? My intention is to convert the coordinates

  • 0

Am I missing something completely obvious here?

My intention is to convert the coordinates into an address and insert it into a div

http://jsfiddle.net/sHLG6/1/

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:36:28+00:00Added an answer on June 3, 2026 at 9:36 pm

    I saw 3 things that popped out immediately with your fiddle.

    1. You never referenced the Google javascript libraries
    2. You never called initialize() and codeLatLng()
    3. You used the value property on the div element but what you really wanted was the getAttribute() method.

    I changed your fiddle so it’s working now

    For the sake of completeness, the original code was as follows

    <div id="latlng" value="54.9882,-1.5747"></div>
    <div id="test"></div>
    var geocoder; function initialize() {
    geocoder = new google.maps.Geocoder(); } function codeLatLng() {
    
        var input = document.getElementById("latlng").value;
        var latlngStr = input.split(",", 2);
        var lat = parseFloat(latlngStr[0]);
        var lng = parseFloat(latlngStr[1]);
        var latlng = new google.maps.LatLng(lat, lng);
        geocoder.geocode({
            'latLng': latlng
        }, function(results, status) {
    
            document.getElementById("test").innerHTML = '' + (results[4].formatted_address); + ''
        }); }​
    

    Working code:

    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
    <div id="latlng" value="54.9882,-1.5747"></div>
    <div id="test"></div>
    var geocoder;
    initialize();
    codeLatLng();
    function initialize() {
    
        geocoder = new google.maps.Geocoder();
    }
    
    function codeLatLng() {
    
        var input = document.getElementById("latlng").getAttribute('value');
    console.log(input);
        var latlngStr = input.split(",", 2);
        var lat = parseFloat(latlngStr[0]);
        var lng = parseFloat(latlngStr[1]);
        var latlng = new google.maps.LatLng(lat, lng);
        geocoder.geocode({
            'latLng': latlng
        }, function(results, status) {
    
            document.getElementById("test").innerHTML = '' + (results[4].formatted_address); + ''
        });
    }​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Probably missing something completely obvious here, but here goes. I'm starting out with Spring
I feel like I must be missing something completely obvious, but I don't see
I'm probably missing something obvious here but here's what I'm trying to do. From
I'm pretty certain I'm missing something really obvious here but this seems quite bizarre.
I have to be missing something obvious here. I don't get why this cast
I'm sure I'm missing something completely obvious, but perhaps someone can point it out.
I feel like I'm missing something obvious here. I just wanted to try putting
Maybe I am missing something completely obvious, but I can't figure out why one
I'm sure I'm missing something obvious here. I have a about twenty data-bound GridViews,
I'm probably missing something really obvious here, but I've been going over this over

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.