# Occur error when trying to get and change button.label in its CustomJS callback

**URL:** <https://discourse.bokeh.org/t/occur-error-when-trying-to-get-and-change-button-label-in-its-customjs-callback/8342>\
**Category:** Community Support\
**Tags:** customjs\
**Created:** [September 1, 2021, 7:29am UTC](https://discourse.bokeh.org/t/occur-error-when-trying-to-get-and-change-button-label-in-its-customjs-callback/8342 "2021-09-01T07:29:18Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![\_jm](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/_/ac91a4/32.png) [@\_jm](https://discourse.bokeh.org/u/_jm)\
**Post date:** [September 1, 2021, 4:22pm UTC](https://discourse.bokeh.org/t/occur-error-when-trying-to-get-and-change-button-label-in-its-customjs-callback/8342/4 "2021-09-01T16:22:37Z")

</div>

Hi @swpper

You access the button label via `cb_obj.origin.label`.

See this post for similar discussion.

> [@Using cb\_obj from button.js\_on\_click()](https://discourse.bokeh.org/t/using-cb-obj-from-button-js-on-click/8241):
>
> Hello, From reading the doc, my understanding was that the variable “cb\_obj” could be always used inside a CustomJS to reference the model that triggered the callback. However, this doesn’t seem the case when used on a button.js\_on\_click callback: from bokeh.models import Button, CustomJS from bokeh.plotting import output\_notebook, show b = Button(label="My button") cb1 = CustomJS(args={'b': b}, code='console.log("cb1: " + b.label)') cb2 = CustomJS(args={}, code='console.log("cb2: " + cb\_ob…

---

_[View the full topic](https://discourse.bokeh.org/t/occur-error-when-trying-to-get-and-change-button-label-in-its-customjs-callback/8342)._
