# Mogelijk om event handlers aan widgets te koppelen in thema/plugin?

**URL:** <https://meta.discourse.org/t/possible-to-attach-event-handlers-to-widgets-in-theme-plugin/166204>\
**Category:** Development\
**Created:** [4 oktober 2020 om 15:42 UTC](https://meta.discourse.org/t/possible-to-attach-event-handlers-to-widgets-in-theme-plugin/166204 "2020-10-04T15:42:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)\
**Post date:** [4 oktober 2020 om 15:49 UTC](https://meta.discourse.org/t/possible-to-attach-event-handlers-to-widgets-in-theme-plugin/166204/2 "2020-10-04T15:49:06Z")

</div>

> [@dchouinard](#):
>
> I’m looking to add a click handler to topic list items (to add custom behavior under some conditions). Is it possible to use something like `api.decorateWidget()` to add an event handler to every instance of a particular widget?

`api.attachWidgetAction` is the way to go. You can read search the codebase and you’ll be gtg.

Examples [here](https://github.com/search?q=org%3Adiscourse+api.attachWidgetAction&type=code)

---

_[View the full topic](https://meta.discourse.org/t/possible-to-attach-event-handlers-to-widgets-in-theme-plugin/166204)._
