Jimmy Lee Jimmy Lee - 2 years ago 124
HTML Question

Clear / Reset Direction Panel in Google Map API v3

Every time we search the route by the direction service, the result will be append to the bottom of the direction panel. Some people recommend to reset the panel in div tab as null... Can anyone suggest how to do it....`

function calcRoute() {

directionsDisplay = new google.maps.DirectionsRenderer({
'map': map,
'preserveViewport': false, //Google Map will change the zoom extent to match with the Direction route if set false
'draggable': true

HTML part:

<div id="directions_panel" style="width:90%"></div>

Answer Source

This should work:

  document.getElementById("directions_panel").innerHTML = "";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download