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

  • Home
  • SEARCH
  • 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 8818667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:09:50+00:00 2026-06-14T05:09:50+00:00

This is the code I am working from: http://jsfiddle.net/DYfbg/12/ If you click map then

  • 0

This is the code I am working from:
http://jsfiddle.net/DYfbg/12/

If you click “map” then try typing a placename it gives you autocomplete suggestions. Then if you click on one of these suggestions it tells you the co-ordinates in an alert box.

What I want to do is capture what is in the input box when the autocomplete option is clicked, and then store it as a variable. Then in the alert box, along with the co-ordinates, I want to print the input box variable into it.

I know this all sounds pretty simple but I am new to javascript so I would really appreciate some input.

This is the segment of code:

google.maps.event.addListener(autocomplete, 'place_changed', function() {
    var place = autocomplete.getPlace();
    **// Store input box as variable**
    if (!place.geometry) {
        current_place = null;
        alert('Cannot find place');
        return;
    } else {
        current_place = place;
        alert('Place is at:' + place.geometry.location);
        **// Print input box varaible aswell**
    } });

EDIT: This is as close as I could get without getting stuck:

    // Set Autocomplete Location Variable equal to #loc input
    $("#loc").val(ac_location);
    // Print Autocomplete Variable
    alert(ac_location);
  • 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-14T05:09:51+00:00Added an answer on June 14, 2026 at 5:09 am

    In the “place” object returned with

    var place = autocomplete.getPlace();
    

    you have all info you need
    Add a console.log and you’ll see all infos returned.
    For example:

    var place = autocomplete.getPlace();
    console.log(place);
    window.myGlobalVar = place.name;
    

    Edit based on notes below:
    it seems original value of inputbox is actually stored in this property:

    autocomplete.gm_accessors_.place.lf.d 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the code im working from: http://jsfiddle.net/X9SkK/ This is the javascript: function showmap()
This is the code I'm working from: http://jsfiddle.net/njDvn/36/ The weird thing is, the autosuggest
This is the code im working from: http://jsfiddle.net/GCt3z/32/ It was going to be a
This is the code I am working from: http://jsfiddle.net/njDvn/75/ var GeoCoded = {done: false};
Here is the code I am working from: http://jsfiddle.net/5yEGX/ I wanted to put something
I'm working with a Google Maps example code , this : http://www.wolfpil.de/v3/drag-from-outside.html which has
I have this code : http://jsfiddle.net/Qchmqs/BSKrG/ <div class=step><-- this is darned wrong <div id=step2><a>Darn</a></div>
I have this code: http://jsfiddle.net/gk5pV/8/ It's function is to add a td value to
I currently have this working fiddle - http://jsfiddle.net/B8Abd/ I would like to use jquerys
JSfiddle (showing the non-working code) here: http://jsfiddle.net/ts2Rr/ I have three boxes that a user

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.