Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

207
Views
Google Places Autocomplete API Get Specific Address Component without Loops or Conditions

Is it possible to get specific address_components from Google Places Autocomplete without having to use loops or conditions? I am trying to understand the loop thing from the sample code of the documentation and was wondering why not just refer it directly instead?

I tried

function fillInAddress() {
  // Get the place details from the autocomplete object.
  var place = autocomplete.getPlace();

  document.getElementById('autocomplete-streetNumber').value = place.address_components.street_number;
  document.getElementById('streetName').value = place.address_components.route;
  document.getElementById('suburb').value = place.address_components.locality;
  document.getElementById('postCode').value = place.address_components.postal_Code;
}

but I get undefined. Not sure if I am missing something.

I also tried places.address_components[0] and I get [object Object].

over 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Virtual assistant