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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:26:43+00:00 2026-05-26T22:26:43+00:00

I have successfuly implemented Google Maps Places V3 autocomplete feature on my input box

  • 0

I have successfuly implemented Google Maps Places V3 autocomplete feature on my input box as per http://web.archive.org/web/20120225114154/http://code.google.com:80/intl/sk-SK/apis/maps/documentation/javascript/places.html. It works nicely, however I would love to know how can I make it select the first option from the suggestions when a user presses enter. I guess I would need some JS magic, but I am very much new to JS and don’t know where to start.

  • 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-05-26T22:26:43+00:00Added an answer on May 26, 2026 at 10:26 pm

    I had the same issue when implementing autocomplete on a site I worked on recently. This is the solution I came up with:

    $("input").focusin(function () {
        $(document).keypress(function (e) {
            if (e.which == 13) {
                var firstResult = $(".pac-container .pac-item:first").text();
    
                var geocoder = new google.maps.Geocoder();
                geocoder.geocode({"address":firstResult }, function(results, status) {
                    if (status == google.maps.GeocoderStatus.OK) {
                        var lat = results[0].geometry.location.lat(),
                            lng = results[0].geometry.location.lng(),
                            placeName = results[0].address_components[0].long_name,
                            latlng = new google.maps.LatLng(lat, lng);
    
                            $(".pac-container .pac-item:first").addClass("pac-selected");
                            $(".pac-container").css("display","none");
                            $("#searchTextField").val(firstResult);
                            $(".pac-container").css("visibility","hidden");
    
                        moveMarker(placeName, latlng);
    
                    }
                });
            } else {
                $(".pac-container").css("visibility","visible");
            }
    
        });
    });
    

    http://jsfiddle.net/dodger/pbbhH/

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

Sidebar

Related Questions

I have successfully implemented code to plot multiple locations on google maps dynamically. Solution:
I have successfully implemented this from android to a java httpservlet on google app
I have implemented the Google map successfully. But one more thing has left to
I have been reading about the responsive web pattern and I have successfully implemented
I have implemented an HTTPOperations class in Android that can successfully produce an HTTP
I have successfully implemented Autocomplete field from database using sfWidgetFormJQueryAutocompleter but i cannot a
I have successfully implemented interop beftween Win32 application and managed .Net dll as described
I have successfully implemented Forms Authentication in SSRS, so it now uses both Roles
I have successfully implemented printing and print preview for my app using the PrintDocument,
I have successfully implemented SUBSONIC DAL in my desktop application. it was superb experience.

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.