☰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

Is it possible to register a click response on a Div?

Community Support
Harm
Harm

I am trying to create a custom component that does something on the js side when clicking the title.

I manage to get it working if I create a div with class “block_title” in HTML and add the following to the script:
$(".block_title").on(“click”, function(){
console.log(‘clicked title’);
});

I want to have all the functionality in my custom component using CustomJS. I tried something like this, but that seems not to work:
header = Div(text=‘Title’, css_classes=[‘block_title’])
header.js_on_event(“click”, CustomJS(code=“console.log(‘clicked title’)”))

Am I missing something? How would what I am trying be possible?

⌁   Link to post
p-himik
p-himik

Bokeh’s Div doesn’t send any events that Bokeh cares about. If you really want it to be clickable, you have to either use what you have already come up with or create a custom model that probably extends Div. Alternatively, just use a Button.

⌁   Link to post

End of archived discussion · Replies are disabled