# ClientSide Marker click event

**URL:** <https://community.thinkgeo.com/t/clientside-marker-click-event/5401>\
**Category:** WebForms\
**Created:** [July 19, 2010, 1:52am UTC](https://community.thinkgeo.com/t/clientside-marker-click-event/5401 "2010-07-19T01:52:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raja](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@Raja](https://community.thinkgeo.com/u/Raja)\
**Post date:** [July 19, 2010, 1:52am UTC](https://community.thinkgeo.com/t/clientside-marker-click-event/5401/1 "2010-07-19T01:52:42Z")

</div>

Dear&nbsp;Friends,

I&nbsp;need&nbsp;the&nbsp;javascript&nbsp;for&nbsp;the&nbsp;marker&nbsp;click&nbsp;event&nbsp;by&nbsp;that&nbsp;I&nbsp;want&nbsp;to&nbsp;get&nbsp;the&nbsp;marker&nbsp;id.

I&nbsp;have&nbsp;created&nbsp;the&nbsp;Markers&nbsp;using&nbsp;SimpleMarkerOverlay.

I&nbsp;want&nbsp;to&nbsp;get&nbsp;the&nbsp;marker&nbsp;id&nbsp;basaed&nbsp;on&nbsp;that&nbsp;I&nbsp;want&nbsp;to&nbsp;add&nbsp;a&nbsp;popup&nbsp;property&nbsp;in&nbsp;client&nbsp;side.

Thanks.

Raja

&nbsp;

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![Khalil](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/k/bc8723/32.png) [@Khalil](https://community.thinkgeo.com/u/Khalil)\
**Post date:** [July 19, 2010, 2:27am UTC](https://community.thinkgeo.com/t/clientside-marker-click-event/5401/2 "2010-07-19T02:27:00Z")

</div>

Raja,

Please&nbsp;refer&nbsp;to&nbsp;the&nbsp;codes&nbsp;below:

`        var OnMapCreated = function(map) {            // MarkerOverlay is the id for your SimpleMarkerOverlay            var markerOverlay = map.getLayer('MarkerOverlay');            for (var i in markerOverlay.markers) {                var marker = markerOverlay.markers[i];                marker.events.register('click', marker, function(evt) {                    var id = this.id;                    // Add your popup like the code below:                    //var popup = new OpenLayers.Popup.FramedCloud();                    //map.addPopup(popup);                });            }        }`

If&nbsp;you&nbsp;still&nbsp;have&nbsp;any&nbsp;questions&nbsp;about&nbsp;it&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;us&nbsp;know.

Thanks,

Khalil
