0

I am working on an iPhone Web App using HTML & CSS. I have currently got the JavaScript/HTML5 Geolocation picking up my current location and showing me it on a Google Map using Lat & Long values. I also want to add these Lat & Long Values into the 'address' text field on the page so I can submit the details.

Here is the link: http://m.belfi.co.uk/form.html

When I click 'find me' I would like the lat and long to be added to the 'address' input field. Have no idea how to do this though :(

1 Answer 1

2

You're looking for the val method:

$('input[name=Address]').val(function(index, oldVal) {
    return oldVal + ": " + lat + ", " + lon;
});
Sign up to request clarification or add additional context in comments.

2 Comments

@McCrum: You'll need to place it inside your showMap function, below the lines where you set the values of lat and lon. Exactly where you have the call to alert will work nicely.
Then you should accept this answer by clicking the hollow check.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.