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 8939803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:54:04+00:00 2026-06-15T10:54:04+00:00

I have a small google map script to get location, either from Lat Lon

  • 0

I have a small google map script to get location, either from Lat Lon pair, or address , and also to UPDATE those lat, lon and address input fields ..

See jsfiddle here

When clicking the “draw” button – a function called codeAddress() is supposed to be called .
but on the firebug console i get :

Error: ReferenceError: codeAddress is not defined

I do not understand why the codeAddress() is not defined …

The strange thing is , that if I move the function OUTSIDE of the

jQuery(document).ready(function(){} it DOES work (See jsFIDDLE)

(I also need to move the var marker – otherwise it will only center the map,and gives marker is undefined error;

So my question is very simple, What am i doing wrong ?
Why the same function works outside the jQuery(document).ready(function(){} but not inside ?

And a sidekick question : How do I get to update the address input field when the marker is dragged (like with the lon lat inputs..) ???

UPDATE – thanks to all – learned another important thing . Unfortunately – all are valid answeres and solutions – but I can accept only one, and for me , the easiest solution to understand (being so unfamiliar with JS – and despite it being maybe a not perfect practice ) is @cowls thanks again to everyone..

  • 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-15T10:54:05+00:00Added an answer on June 15, 2026 at 10:54 am

    Rather than use onclick, you should assign a click handler to the required elements INSIDE your document.ready method.

    E.g.

    $(input).click(function() { codeAddress() });
    

    Would assign the code address function to the click event for all input boxes, obviously you want to target this at specific classes or ids

    this is best practice rather than using onclick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made an update on Google App Engine with a small fix and
I have been trying to get Markers to Cluster on a Google map for
I have generated a script using maps.google.com site, it is showing my required location
I just tried to use Google Map Buddy to get satellite image from Google
I have a small Google maps v3 script that works fine on all proper
I have small database of business and their addresses. Using the Google Geocode API
I have a small Python program, which uses a Google Maps API secret key.
I have small script in bash, which is generating graphs via gnuplot. Everything works
I'm trying to show a small static google map in my app. I'm wondering
I'm using geocoding to display a google map with the users location displayed. I'm

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.