Trigger event after GDirections.loadFromWaypoints in Google Maps API

I'm trying to add some text to the directions that the Google Maps API returns to the specified div (directionPanel). This code below will work fine, except that the jQuery line is run before loadFromWaypoint finishes modifying the DOM. If I run this line by manually executing it after the content has finished loading, it will execute as expected.

directions = new GDirections(map, directionsPanel);
directions.loadFromWaypoints(waypoints);

$("td[@jscontent='address']").append(" some content");

      

How can I add some kind of listener (maybe either the loadFromWaypoints callback function, or the Panel div itself) to execute my jQuery string after the DOM reload completes?

+1


source to share


1 answer


The documentation is not great, but it talks about the "load" and the "addoverlay" event http://code.google.com/apis/maps/documentation/reference.html#GDirections



GEvent.addListener(directions, "addoverlay", function() {
    $("td[jscontent='address']").append(" some content"); 
});

      

+2


source







All Articles