Are you 100% sure that having a clickable div is a good idea in your case? Is there really a good reason to not just use a Button
?
For reference, this question has been asked many times before. Just the first 3 from Discourse that I found:
- Is it possible to register a click response on a Div?
- Interaction between custom Javascript and BokehJS / Python
-
How to add CustomJS callback to chart title (not about
Div
but very similar)
The answer is the same every time - either use a Button
or create a custom model that doesn’t require Bokeh events to know that a user has clicked on it. For an example, take a look at how AbstractButtonView.render
is implemented - it uses a regular JS event to know when the button is clicked.