Is it possible to execute a block of javascript code when an element is clicked.

```
<a id="id-name" href="#">ABC</a>

```

I want to execute the following code only if above link is clicked

```
<script>
if(link-clicked){
  var marker = new google.maps.Marker({
    position: new google.maps.LatLng( 12.1223, 123.324 ),
    map: map,
    title: Some Location
  });
}
</script>

```

Note: just pure javascript