title: How to get longitude and latitude of a city/country inputted through an input box?
body: <p>I have this code,</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt;
   &lt;script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  function myIP(){
  $("#btn").click(function(){
              var geocoder =  new google.maps.Geocoder();
      geocoder.geocode( { 'address': '#city'}, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
              alert("location : " + results[0].geometry.location.lat() + " " +results[0].geometry.location.lng()); 
            } else {
              alert("Something got wrong " + status);
            }
          });
  });
  }
   &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="myIP()"&gt;
  &lt;input type="text" id= "city"&gt;
  &lt;input id="btn" type="button" value="get Lat&amp;Long" /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This will give me latitude and longitude of the inputted city in small dialog box. But I need this in the same page or parent page. Please help me</p>