Guest User

Untitled

a guest
Feb 13th, 2018
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. POSTCODE: <input type="text" name="adv_postcode" id="adv_postcode" class="addressfields"/>
  2.  
  3. <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAJcNfHosSZtteJp9jndsH8pJ4YZlBMHTA&libraries=places&sensor=false&callback=initialize" async defer >
  4.  
  5. function initialize() {
  6. $('#adv_postcode').each(function () {
  7. initialize2(this);
  8. });
  9. }
  10. function initialize2(elementID) {
  11. var options = {
  12. componentRestrictions: {
  13. country: 'uk'
  14. }
  15. };
  16. var autocomplete_element = new google.maps.places.Autocomplete(elementID, options);
  17.  
  18. autocomplete_element.addListener('place_changed', function () {
  19. elementID.value = fillInAddress(autocomplete_element);
  20. });
  21. }
Add Comment
Please, Sign In to add comment