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:
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?