Jump to content

Andyd

New Members
  • Posts

    2
  • Joined

  • Last visited

Andyd's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am starting to lose my mind and cant get my head around this. I have the following field <div class="form-group"> <label for="exampleFormControlInput1">Job Address</label> <input type="text" class="form-control maps-autocomplete" id="JobAddress" > </div> and this javascript code <script src="https://maps.googleapis.com/maps/api/js?key=[GAPI_KEY]&loading=async&libraries=places" type="text/javascript"></script> <script> function initialize() { var acInputs = document.getElementsByClassName('maps-autocomplete'); for (var i = 0; i < acInputs.length; i++) { var options = { types: ['geocode'], componentRestrictions: { country: 'uk' }, fields: ['formatted_address'], types: ['address'], }; var autocomplete = new google.maps.places.Autocomplete(acInputs[i],options); autocomplete.inputId = acInputs[i].id; } } initialize(); </script> It works bur wont fetch the postal code or county / state Can someone please help as I've tried googling but cant find anything without adding a map the the page which i don't want to do Thanks in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.