JSFiddle - React, Tailwind, and code Playground

by Kabir Hossain

HTML

<!DOCTYPE html>
<html>
<head>
    <body><p>Show a user address on google map</p>
    </body>
    </html?

JavaScript

<!DOCTYPE html>
<html>
<head>
<script
src="http://maps.googleapis.com/maps/api/js?sensor=false">
</script>

<script>
var geocoder =  new google.maps.Geocoder();
    geocoder.geocode( { 'address': 'Nikunju-2,dhaka,Bangladesh'}, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
            var v1 =results[0].geometry.location.lat()
            var v2 = results[0].geometry.location.lng();
              //alert("Motijheel, Dhaka, BD located in coordinate at Lat: "+v1+" & Lngtd: "+v2); 
          } else {
            alert("Something got wrong " + status);
          }

        

var myCenter=new google.maps.LatLng(v1,v2);

function initialize()
{
var mapProp = {
  center:myCenter,
  zoom:10,
  mapTypeId:google.maps.MapTypeId.ROADMAP
  };

var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);

var marker=new google.maps.Marker({
  position:myCenter,
  });

marker.setMap(map);
}

google.maps.event.addDomListener(window, 'load', initialize);
});
</script>
</head>

<body>
<div id="googleMap" style="width:500px;height:380px;"></div>
</body>
</html>