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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:41:24+00:00 2026-06-13T14:41:24+00:00

I use Places library to autocomplete address input. Search is limited to only one

  • 0

I use Places library to autocomplete address input. Search is limited to only one city, and I get output like this:

“Rossiya, Moskva, Leninskiy prospekt 28”

How to hide “Rossiya, Moskva”? …

My query:

function() {
        // Search bounds
        var p1 = new google.maps.LatLng(54.686534, 35.463867);
        var p2 = new google.maps.LatLng(56.926993, 39.506836);
        self.options = {
            bounds : new google.maps.LatLngBounds(p1, p2),
            componentRestrictions: {country: 'ru'},
        };

        var elements = document.querySelectorAll('.address');

        for ( var i = 0; i < elements.length; i++) {
            var autocomplete = new google.maps.places.Autocomplete(elements[i],
                    self.options);
        }
  • 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-13T14:41:25+00:00Added an answer on June 13, 2026 at 2:41 pm

    You can but you have to replace the value of the input field in two places.

    Example:

    var autocomplete = new google.maps.places.Autocomplete(input, placesOptions);
    var input = document.getElementById('searchTextField');
    

    inside the ‘place_changed’ event you need to do the following:

    placeResult = autocomplete.getPlace();
    //This will get only the address
    input.value = placeResult.name;
    

    This will change the value in the searchtextfield to the street address.

    The second place is a bit tricky:

    input.addEventListener('blur', function(){
    // timeoutfunction allows to force the autocomplete field to only display the street name.
    if(placeResult){ setTimeout(function(){ input.value = placeResult.name; }, 1); } });
    

    The reason why we have to do this is because if you only add the event listener for blur, google places will populate the input field with the full address, so you have to ‘wait’ for google to update and then force your change by waiting some miliseconds.

    Try it without the setTimeout function and you will see what I mean.

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

Sidebar

Related Questions

On various places they said that you should use @ManagedProperty to get a request
I'm trying to use the autocomplete from the Google Places API. I have the
I would like to use a templated typedef in various places, among other things
I am trying to use maps in my application and i get this error,
I am trying to use Google's places API. I downloaded google-api-java-client-1.6.0-beta.zip library and I'm
We would like to organize a C++ project like this: project/ lib1/ (first library)
I am trying to use the Places API and I was initially trying to
Some places in my flex app, I use ResourceManager.getInstance().getString, and other places I use
I use DataGridView, and in some places I add control to it (e.g. textbox,
I am writing an embedded app. In some places, I use std::ostringstream a lot,

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.