# How to access $(this) with api.attachWidgetAction?

**URL:** <https://meta.discourse.org/t/how-to-access-this-with-api-attachwidgetaction/43570>\
**Category:** Development\
**Created:** [2016 年 5 月 2 日午後 8:34 UTC](https://meta.discourse.org/t/how-to-access-this-with-api-attachwidgetaction/43570 "2016-05-02T20:34:56Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![stevenpslade](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stevenpslade/32/53550_2.png) [@stevenpslade](https://meta.discourse.org/u/stevenpslade)\
**Post date:** [2016 年 5 月 2 日午後 8:34 UTC](https://meta.discourse.org/t/how-to-access-this-with-api-attachwidgetaction/43570/1 "2016-05-02T20:34:56Z")

</div>

I am adding a new post menu button with `api.addPostMenuButton`.

I would like to access the data of this post-menu button on click using `api.attachWidgetAction`.

Ideally, it would be the equivalent of:

`$(this).attr('data-something')`

Any ideas?

---

_[View the full topic](https://meta.discourse.org/t/how-to-access-this-with-api-attachwidgetaction/43570)._
