Add 'onclick' to Dash html buttons in python

I need to add an onclick event to an html button I’ve created, but while the standard dash html library includes buttons, it does not allow for ‘onclick’ as an argument. Where does dash compile the ‘pythonhtml’ to actual html so I can go in and add this functionality. I’ve already added ‘onclick’ as an option in dash_html_components in metadeta.json and bundle.js

@ekee Did you ever figure this out? There are similar questions all over the forum with no answers.

me too i don’t know how can I add onclick trigger for calling a javascript function in plotly dash

Hello @adithiyan,

You can add a clientside callback,

app.clientside_callback(
‘’’
function (n1) {
     myfunction()
     return window.dash_clientside.no_update
}’’’,
Output(‘button’,’n_clicks’),
Input(‘button’,’n_clicks’)

)

Where myfunction represents your targeted function.