---
title: "How to automatically fill our current location in the Places TextArea for my MVC application ?"  
description: "How to automatically fill our current location in the Places TextArea for my MVC application ?"  
author: "Anonymous User"  
published: 2018-10-23  
updated: 2018-10-23  
canonical: https://www.mindstick.com/forum/34690/how-to-automatically-fill-our-current-location-in-the-places-textarea-for-my-mvc-application  
category: "c#"  
tags: ["ajax", "jquery", "asp.net mvc"]  
reading_time: 2 minutes  

---

# How to automatically fill our current location in the Places TextArea for my MVC application ?

Fill [user location](https://www.mindstick.com/forum/886/launching-jquery-plugins-depending-on-the-user-location) automatically in Place/Location [text field](https://www.mindstick.com/forum/33753/how-to-get-value-from-text-field-on-button-click-in-ios).

![How to automatically fill our current location in the Places TextArea for my MVC application ?](https://www.mindstick.com/mindstickforums/b56b1919-127c-4eb0-9459-f4ee352c6f9c/images/f06f6ae5-c167-4267-bd4d-56fa4030efd1.png)\

## Replies

### Reply by Anonymous User

**Fill [location](https://www.mindstick.com/blog/11636/relocating-business-or-office-to-another-location) in the [text](https://www.mindstick.com/blog/301635/did-people-reinvent-texting-to-express-the-full-range-of-emotions) field via automatically**

```
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript" src="https://code.jquery.com/jquery-2.2.3.js"></script>
</head>
<body>
 <span><b> Current Address:</b></span>
   <div id="address"></div>
        <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript">
        $(function () {
            CurrentLocation();
        });
        function CurrentLocation() {
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(showPosition);
            } else {
                alert("Geolocation is not supported by this browser.");
            }
        }
        function showPosition(position) {
            latitude = position.coords.latitude;
            longitude = position.coords.longitude;
            var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
            var geocoder = geocoder = new google.maps.Geocoder();
            geocoder.geocode({ 'latLng': latlng }, function (results, status) {
                if (status == google.maps.GeocoderStatus.OK) {
                    if (results[1]) {
                        document.getElementById("address").innerHTML = results[1].formatted_address;
                    }
                }
            });
        }
    </script>
</body>
</html>
```

On Mozilla browser

![How to automatically fill our current location in the Places TextArea for my MVC application ?](https://www.mindstick.com/mindstickforums/b56b1919-127c-4eb0-9459-f4ee352c6f9c/images/13991d8a-fb27-4315-9769-01426918db31.png)**\**

## On Chrome

![How to automatically fill our current location in the Places TextArea for my MVC application ?](https://www.mindstick.com/mindstickforums/b56b1919-127c-4eb0-9459-f4ee352c6f9c/images/624264a5-4754-4d3d-9d2a-02bfc259db9a.png)**\**

**Result**

![How to automatically fill our current location in the Places TextArea for my MVC application ?](https://www.mindstick.com/mindstickforums/b56b1919-127c-4eb0-9459-f4ee352c6f9c/images/6b645944-245f-47e4-964f-a97d212036af.png)**\**


---

Original Source: https://www.mindstick.com/forum/34690/how-to-automatically-fill-our-current-location-in-the-places-textarea-for-my-mvc-application

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
