@florescorreia Sorry for the delay here. I looked into this and you’re correct, this example doesn’t work.
The syntax that you supplied looks out of data from our official documentation: http://dash.plotly.com/clientside-callbacks. Where did you find this example? I’d like to make sure that it’s updated.
To be more specific, this particular code block doesn’t work because there is a syntax error - an extra } at the end. This is reported in the browser’s dev tools console:
Thanks, I tried your solution, but still it does not work – I suspect it’s something on my localhost server (ubuntu 20.04) that I apparently don’t know how to address.
However, the example works just fine when I embed the js code in the callback like this:
Switching to client-side callback means that additional JS files must be sent to the client. If you already had your Dash app running and your web browser client connected to it, then you added a client-side callback, your client session may throw this error as it still has the old JavaScript files. To fix this, you can force a page reload that includes all JavaScript files with Ctrl+F5. That resolved this error for me.