# Click event for legend text on editable plot

**URL:** <https://community.plotly.com/t/click-event-for-legend-text-on-editable-plot/27439>\
**Category:** plotly.js\
**Created:** [August 19, 2019, 4:12pm UTC](https://community.plotly.com/t/click-event-for-legend-text-on-editable-plot/27439 "2019-08-19T16:12:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![koushikphy](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@koushikphy](https://community.plotly.com/u/koushikphy)\
**Post date:** [August 19, 2019, 4:12pm UTC](https://community.plotly.com/t/click-event-for-legend-text-on-editable-plot/27439/1 "2019-08-19T16:12:35Z")

</div>

When you make the plot editable, you can edit the legend text by clicking on it. Now I want to catch that newly entered text programmatically. I tried with `relayout`, but it doesn’t work. Although `plotly_legendclick` is triggered on clicking the legend, but how to catch the text after one is done entering the text? What event is emitted while editing the legend text?

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [August 19, 2019, 10:28pm UTC](https://community.plotly.com/t/click-event-for-legend-text-on-editable-plot/27439/2 "2019-08-19T22:28:43Z")

</div>

> [@koushikphy](#):
>
> . I tried with `relayout` , but it doesn’t work

Try listening to `plotly_restyle`, editing the legend text is equivalent to calling:

```js
Plotly.restyle('graph', 'name', /* new trace name */)

```
