Adding click event to KMLLayer Placemarks and Markers

How do i attach an onclick event to Placemarks specified in the KML file. Can event listeners be added to both google maps and google earth plugin? How would I go about this?


In the Google Earth plugin..., href, function(kmlObject) {});, 'click', function(event) {
    var kmlPlacemark = event.getTarget();

In Google Maps API

var ctaLayer = new google.maps.KmlLayer('http://www.****.com/index.kml');
google.maps.event.addListener(ctaLayer, 'click', function(kmlEvent) {
    var text = kmlEvent.featureData.description;

Seemingly the onlick event is wrapped up when the kml loads (GMaps v3, kml with Placemarks) Any Placemark references to "BallonStyle" bundled in the same kml file causes these to replace the default popup - and you can achieve a lot with them.

These are the kml elements supported by Gmaps v3

If your question is how to intercept that onlick event, then I am sorry I do not know how you can achieve that.

Need Your Help

pass function in json and execute

javascript jquery json observer-pattern

Is there any way that I can pass a function as a json string (conversion with JSON.stringify), send it to another function, parse the json and then execute the function that was in the json? I am u...

Rails catch-all route

ruby-on-rails ruby ruby-on-rails-3

I am using rails 3.0.14, and I am constructing routes.rb using the resourceful style. I'd like to have a wildcard route that catches all requests that do not match to any route stated.