How to check an overlay type after clicking
- After you create a Marker or Geometry that you want then let's use event 'overlayClick'
map.Event.bind('overlayClick', function(overlay) { if (overlay instanceof longdo.Marker) { document.getElementById('overlayselect').innerHTML = 'Marker'; } else if(overlay instanceof longdo.Polyline){ document.getElementById('overlayselect').innerHTML = 'Polyline'; } else if(overlay instanceof longdo.Polygon){ document.getElementById('overlayselect').innerHTML = 'Polygon'; } else if(overlay instanceof longdo.Dot){ document.getElementById('overlayselect').innerHTML = 'Dot'; } else if(overlay instanceof longdo.Circle){ document.getElementById('overlayselect').innerHTML = 'Circle'; } });
- overlayClick: User click overlay event
Example
click overlay
More information: Event Handler