title: Google Maps API v3 marker on click with infowindow
body: <p>I have problem with infowindow. I create marker when i click on map but i want to show infowindow too. This code not working with this part: </p>
  
  <pre><code>google.maps.event.addListener(marker, 'click', function() {
      infowindow.open(map, marker);
  });
  </code></pre>
  
  <p>Here is code below.. Thank for help</p>
  
  <pre><code>var pridat;
  var map;
  
  function initialize() {
      var locc = new google.maps.LatLng(49.938682,17.903331);
      var mapOptions = {
          zoom: 14,
          center: locc,
          mapTypeId: google.maps.MapTypeId.ROADMAP
      }
  
      map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
      directionsDisplay.setMap(map);
  
      var contentwindow = '&lt;div&gt;your point&lt;/div&gt;'
      var infowindow = new google.maps.InfoWindow({
          content: contentwindow
      });
  
      // IF I REMOVE THIS PART -&gt; IT WORKS, BUT WITHOUT INFOWINDOW
      google.maps.event.addListener(marker, 'click', function(){
          infowindow.open(map, marker);
      });
      // END OF PART
  
      google.maps.event.addListener(map, 'rightclick', function(event) {
          placeMarker(event.latLng);
      });
  }
  
  function placeMarker(location) {
      if (marker) {
          marker.setPosition(location);
      } else {
          marker = new google.maps.Marker({
              position: location,
              map: map,
              title: 'My point',
              draggable: true,
          });
      }
  }
  </code></pre>