<div dir="ltr"><div><div><br clear="all">Hi,<div><br></div><div>I need an even to be triggered when a feature is 
selected on the map. I used following code for it. But it does not work.
 Can someone please tell what may be the issue?</div><div><br></div>
<div>var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;</div><div>renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;</div><div><br></div><div>var layer = new OpenLayers.Layer.Vector("Scratchpad", {</div>

<div>    renderers: renderer</div><div>});   </div><div><br></div><div><div>var toolbar = new OpenLayers.Control.EditingToolbar(layer);</div><div>    toolbar.addControls([new OpenLayers.Control.ModifyFeature(layer, {</div>

<div>        title: "Select feature"</div><div>    })]);</div><div><br></div><div>    map = new OpenLayers.Map('map_element_1', {</div><div>        controls: [</div><div>            toolbar,</div><div>            new OpenLayers.Control.PanZoomBar(),</div>

<div>            new OpenLayers.Control.PanPanel()</div><div>        ],</div><div>        layers: [</div><div>            new OpenLayers.Layer.WMS(</div><div>                "OSM", "<a href="http://maps.opengeo.org/geowebcache/service/wms" target="_blank">http://maps.opengeo.org/geowebcache/service/wms</a>",</div>

<div>                {layers: "openstreetmap", format: "image/png"}</div><div>            ),</div><div>            new OpenLayers.Layer.WMS(</div><div>                "OpenLayers WMS", "<a href="http://vmap0.tiles.osgeo.org/wms/vmap0" target="_blank">http://vmap0.tiles.osgeo.org/wms/vmap0</a>",</div>

<div>                {layers: 'basic'}</div><div>            ),</div><div>            layer</div><div>        ],</div><div>        zoom: 4</div><div>    });</div><div><br></div><div>    layer.events.on({</div><div>

        'featureselected': function (feature) {</div><div>            document.getElementById('test').innerHTML = 'abc';</div><div>        },<br></div><div>        'featureunselected': function (feature) {</div>

<div>        }<br></div><div>    });</div></div><br></div>Thanks,<br></div>Nipuni<br><div><div>-- <br><div><span>Nipuni Piyabasi Perera</span></div><span>Undergraduate</span><div>Department of Computer Science And Engineering</div>
<div>University of Moratuwa<div>Sri Lanka</div></div>
</div></div></div>