☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Js_on_event on Div widget

Community Support
rindis
rindis

Is it possible to use js_on_event for Div widgets? I would ultimately like to trigger a callback in python whenever an event is triggered on a Div widget (tap, press, mouse enter, mouse leave, etc), and I suppose going through js_on_event is the way to do that(?). Anyways, I have tried the following:

from bokeh import events
from bokeh.layouts import layout
from bokeh.models import CustomJS, Div

from lib.bokeh.util.bokeh_util import display

div = Div(style={'background': 'gray', 'min-width': '500px', 'min-height': '500px'})

div.js_on_event(events.Tap, CustomJS(code="""
    console.log("Does this work?")
    """))

display(layout(div, sizing_mode='stretch_both'))

But this does not seem to have any effect.

display is a convenience function that fires up a bokeh Server.

⌁   Link to post

End of archived discussion · Replies are disabled