Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
33
rated 0 times [  39] [ 6]  / answers: 1 / hits: 36441  / 13 Years ago, tue, may 17, 2011, 12:00:00

I am using the following code for getting location and city, but can't get it to give me the zip code if the person gives me permission. Please let me know if this is possible to do with this code. All it is doing is populating a text field if given permission to access.



<script type=text/javascript>
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$(#location).val(position.address.city+, +position.address.region);
});
}



More From » html

 Answers
2

Try position.address.postalCode



See the following demo i made to see what is supported by your browser/device



https://jsfiddle.net/gaby/Sx5cj/


[#92190] Monday, May 16, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mercedez

Total Points: 525
Total Questions: 103
Total Answers: 102

Location: Trinidad and Tobago
Member since Fri, Mar 24, 2023
1 Year ago
mercedez questions
;