title: "Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.Tq @ VM107:37mF , when gmap is adding
body: <p>I am newbie, practicing html and jquery. 
  Could any one please help me resolving this error? 
  when i was try to add google map dynamically, i was getting an error like Uncaught typeError: failed to execute 'getComputedStyle' on 'window': parameter.</p>
  
  <p>html markup is:</p>
  
  <pre><code>&lt;type="submit" id="locate"&gt;Find me&lt;/button&gt;
  &lt;div id="gmap"&gt; &lt;/div&gt;
  
  enter code here
  
      $(document).ready(function () {
  
          $('#locate').on('click', function (e) {
              e.preventDefault();
              if (navigator.geolocation) {
                  navigator.geolocation.getCurrentPosition(showPosition);
              }
              else {
                  console.log('Geolocation is not supported by your browser');
              }
          });
          var latlng,
           mapOptions,
           map;
  
          showPosition = function (position) {
              latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude)
              mapOptions = {
                  center: latlng,
                  mapTypeId: google.maps.MapTypeId.ROADMAP,
                  zoom: 15
              }
              Map = new google.maps.Map($('#gmap'), mapOptions);
              var marker = new google.maps.Marker({
                  position: latlng,
                  map: map,
                  title: "You are here"
              })
         }
      });
  </code></pre>