Skip to content Skip to sidebar Skip to footer

Missing ] After Element List For Google Maps Event Object

I'm trying to call moreInfo() function on the onclick event and to give it information about the click event. here are code samples: google.maps.event.addListener(SomeArea, 'click'

Solution 1:

the content for an infoWindow may also be a DOMNode.

Create a DOMNode and insert the button into this node, then you'll be able to apply a click-listener to the button(and pass any type of argument):

functionshowTB(event) {

  var contentElement = document.createElement('div'),
      btn            = document.createElement('button');
  contentElement.appendChild(document.createTextNode(event.latLng));
  contentElement.appendChild(document.createElement('br'));
  contentElement.appendChild(btn);
  btn.appendChild(document.createTextNode('More'));
  google.maps.event.addDomListener(btn,'click',function(){ moreInfo(event);})
  infoWindow.setContent(contentElement);

}

Demo: http://jsfiddle.net/doktormolle/N5Etg/

Post a Comment for "Missing ] After Element List For Google Maps Event Object"