title: Google Maps api V3 update marker
body: <p>I've got a map that loads.
  I want to add a marker that gets it's lat and long from text boxes, and I can't fathom it. </p>
  
  <p>Nothing happens when I click on the updatemap button.</p>
  
  <p>Here's my code so far:</p>
  
  <pre><code>$(document).ready(function () {
      alert("Dom, dom dom dom dom");
  
  
  var map;
  var marker;
  
  function initialize() {
      var myLatlng = new google.maps.LatLng(40.65, -74);
      var myOptions = {
          zoom: 2,
          center: myLatlng,
          mapTypeId: google.maps.MapTypeId.ROADMAP,
      }
  
      var map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
  }
  
  
  
  $("#updateMap").click(function(){
  
  
      var newLatLng = new google.maps.LatLng(lat, lng);
      marker.setPosition(newLatLng);
  
      var lat = parseFloat(document.getElementById('markerLat').value);
      var lng = parseFloat(document.getElementById('markerLng').value);
      var newLatLng = new google.maps.LatLng(lat, lng);
  
  
      marker = new google.maps.Marker({
          position: newLatLng,
          map: map,
          draggable: true
      });
  
  
  });
  
  
  });
  
  
  
  // Onload handler to fire off the app.
  google.maps.event.addDomListener(window, 'load', initialize);
  
  });
  </code></pre>