JSFiddle - React, Tailwind, and code Playground
by B L Praveen
HTML
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<input type="text" id= "city">
<input id="btn" type="button" value="get Lat&Long" />
<div class="push-down"></div>
CSS
.push-down {margin-top: 25px;}
JavaScript
$("#btn").click(function(){
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': $('#city').val()}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
$('.push-down').text("location : " + results[0].geometry.location.lat() + " " +results[0].geometry.location.lng());
} else {
$('.push-down').text("Something got wrong " + status);
}
});
});