title: Insert GEO location into input HTML
body: <p>I'm trying to locate City and Country and insert the info inside  tag field as value.
  Tried several options and none worked for me, the original code successfully inserted the info into  element but this is not what I need.</p>
  
  <p>I have tried to give id name to my input tags and insert the text inside like this:  $('#country').value(fulladd[count-1]);
  but it didn't worked, the output is</p>
  
  <pre><code>&lt;input type="text" tabindex="3" name="city"&gt;Whatever&lt;/input&gt;
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function locate() {
  
    var location = document.getElementById("location");
    var apiKey = 'f536d4c3330c0a1391370d1443cee848';
    var url = 'https://api.forecast.io/forecast/';
  
    navigator.geolocation.getCurrentPosition(success, error);
  
    function success(position) {
      latitude = position.coords.latitude;
      longitude = position.coords.longitude;
  
  
       $.getJSON("http://maps.googleapis.com/maps/api/geocode/json?latlng="+latitude + "," + longitude + "&amp;language=en", function(data) {
    var fulladd = data.results[0].formatted_address.split(",");
    var count= fulladd.length;
        $('#country').text(fulladd[count-1]);
        $('#city').text(fulladd[count-2]);
      });
    }
  
    function error() {
      location.innerHTML = "Unable to retrieve your location";
    }
  $('#country').text('Locating...')
  }
  
  locate();</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html lang="en"&gt;
  
     &lt;head&gt;
        &lt;meta charset="utf-8"&gt;
        &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
        &lt;link rel="stylesheet" href="style.css" /&gt;
        &lt;title&gt; Locating &lt;/title&gt;
     &lt;/head&gt;
  
     &lt;body&gt;
  &lt;form id="form1"&gt;
       &lt;div class="registration_form"&gt;
        &lt;section id="location"&gt;
              &lt;div id="country"&gt;
                  &lt;label&gt;
                  Country&lt;br&gt;&lt;input type="text" tabindex="3" value="0" 
                               name="country" &gt;
                  &lt;/label&gt;
              &lt;/div&gt;
              &lt;div id="city"&gt;
                  &lt;label&gt;
                  City&lt;br&gt;&lt;input type="text" tabindex="3" name="city"&gt;
                  &lt;/label&gt;
              &lt;/div&gt;
              &lt;div&gt;
         &lt;/section&gt;
      &lt;/div&gt;
  &lt;/form&gt;
     
     &lt;/body&gt;
  
     &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt;
     &lt;script src="app.js"&gt;&lt;/script&gt;
  
  
  &lt;/html&gt; </code></pre>
  </div>
  </div>
  </p>