# eventClick

> FullCalendar v3 documentation, for an old release. Web version: https://legacy.fullcalendar.io/v3/eventClick
>
> Latest version (v7): https://fullcalendar.io/docs/eventClick.md

Triggered when the user clicks an event.

<div class='spec' markdown='1'>
function( *event*, *jsEvent*, *view* ) { }
</div>

`event` is an [Event Object](https://legacy.fullcalendar.io/v3/event-object.md) that holds the event's information (date, title, etc).

`jsEvent` holds the jQuery event with low-level information such as click coordinates.

`view` holds the current [View Object](https://legacy.fullcalendar.io/v3/view-object.md).

Within the callback function, `this` is set to the event's `<div>` element.

Here is an example demonstrating all these variables:

```js
$('#calendar').fullCalendar({
  eventClick: function(calEvent, jsEvent, view) {

    alert('Event: ' + calEvent.title);
    alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
    alert('View: ' + view.name);

    // change the border color just for fun
    $(this).css('border-color', 'red');

  }
});
```

eventClick will *not* be triggered for [background events](https://legacy.fullcalendar.io/v3/background-events.md).

[View a simple demo](https://legacy.fullcalendar.io/v3/eventClick-demo) of eventClick.


## Return Value

Normally, if the [Event Object](https://legacy.fullcalendar.io/v3/event-object.md) has its `url` property set, a click on the event will cause the browser to visit the event's url (in the same window/tab). Returning `false` from within your function will prevent this from happening.

Often, developers want an event's `url` to open in a different tab or a popup window. The following example shows how to do this:

```js
$('#calendar').fullCalendar({
  events: [
    {
      title: 'My Event',
      start: '2010-01-01',
      url: 'https://google.com/'
    }
    // other events here
  ],
  eventClick: function(event) {
    if (event.url) {
      window.open(event.url);
      return false;
    }
  }
});
```

The `window.open` function can take [many other options](https://www.w3schools.com/jsref/met_win_open.asp).
