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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:17:39+00:00 2026-06-18T06:17:39+00:00

Short version: I’m using google’s autocomplete places from the Google Places Library (here https://developers.google.com/maps/documentation/javascript/places

  • 0

Short version:

I’m using google’s autocomplete places from the Google Places Library (here https://developers.google.com/maps/documentation/javascript/places) and I need to tell when a user has selected a place from the auto-complete list and when they have clicked elsewhere, tabbed out, etc.

My goal is to run a function when a user interacts with the input element but does not select an autocomplete option.

More details:

In looking at the documentation, it appears the only event is fired when (really, if) the places change, which happens after a (potentially long) server round trip. If the user doesn’t select anything from the list, that event is never fired. (Docs at https://developers.google.com/maps/documentation/javascript/reference?hl=fr#Autocomplete)

I can attach a listener to the blur event for the input element the autocomplete attaches to, but the problem is that the blur event happens well before the places_changed event happens.

So far have tried a number of things including listening for events on the autocomplete suggestions with something like the following:

$('body').on('click', '.pac-item', function(){alert.log('yay!');});

the google library apparently eats the events though.

Any help would be greatly appreciated.

Thanks!

  • 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-18T06:17:40+00:00Added an answer on June 18, 2026 at 6:17 am

    Rather than using an event to check, you should check when the form submits. Here it is step by step:

    1. When user selects a place, store the place AND the text value of the input
    2. When the form submits, check if the value of the input is the same as what you saved
    3. If it is different, or if there is no place saved, then perform a manual places request

    Demo: http://jsfiddle.net/robertdodd/FSRd8/7/

    I put together a small demo above. What I did is attach a validation method to the form. This method will check the data before submitting the form, and if required perform a manual lookup first.

    function validateForm() {
        searchfield = $('#searchfield').val();
        if (searchfield == "" || searchfield == null) { 
            // No text entered
        } else if (place && searchfield == placesearch) { 
            // Success
            return true;
        } else { 
            // place info and search text do not match, perform manual lookup   
            // when lookup is complete, the callback function will store the place info
            // and resubmit the form
        }
        return false;
    }
    

    This is just an outline of what happens, all the code is in the demo if you wish to see it.

    I hope this helps you!

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

Sidebar

Related Questions

Short version: how can I detect overflow using the fixed-point multiplication described here but
Short version Is there a way to prevent R from ever using any virtual
Short version: How can I map two columns from table A and B if
Short version Is it possible to access variables from a module declared as our
Short version: I'm trying to get something like this to work in c using
Short version: How can I make sure that my component GUIDs remain stable using
Short version of Problem Autocomplete works when the input string matches the result string,
Short version: Can we read from dozens or hundreds of table partitions in a
Short Version: Does anyone know how to do a simple date insert using Doctrine2?
Short version: How can I have my form's button label text differ from the

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.