Tooltips jquery

Dear all,

I am trying to get jquery tooltips working with dash. In particular I would like to have tooltips with different widths.

The following fiddle illustrates what I am trying to do. I would like to target a specifc id and set the tooltip properties.

[](http://Fiddle example)

When I target all elements the jquery tooltips show up nicely for both elements.

// myjavascript.js

But if I try to select just one I do not succeed. Both elements fall back to the standard html tooltip.


Since the jsfiddle is working w/o a problem, I am suspecting there is some subtlety about the way dash works that I am not seeing. Any help will be much appreciated.

PS Here the corresponding dash app.

import dash
import dash_core_components as dcc
import dash_html_components as html

external_scripts = [
external_stylesheets = [

app = dash.Dash(__name__, \

mytext = '''
Some text...

layout = html.Div([
    html.Div(id='myid', children=['Some Text'], title=mytext),
    html.Div(id='myid2', children=['Some Text'], title=mytext)

app.layout = layout

if __name__ == '__main__':
    app.run_server(host='', debug=True, port=8050)

On the frontend, a Dash app is actually a React app. React, unfortunately, does play well with anything else manipulating the DOM, as you’re trying to do with jQuery.

You’ll either need to find a pure CSS/HTML option, or find a React component that you can convert into a Dash component.

Thanks a lot for the feedback. I will try other possibilities.

You can also try out dash-bootstrap-components. One of the components is a tooltip, I just tried it out and it works great!

Let me know how it works out.


This is a very interesting project. I am currently working with the standard dash stylesheet:

Just swapping in a bootstrap stylesheet changes my app quite a bit. While it seems possible to get the grid system alone, the other components are not so easily extractable, right?

I will definately give dbc a go and give feedback. Perhaps it is worth switching entirely.

If you really don’t want all of Bootstrap and just want the dbc.Tooltip, you could include only the Bootstrap tooltip styles by copying them into your own stylesheet, and then not linking to Bootstrap CSS.

1 Like

Thanks for the pointer!

you can try to use visdcc.Run_js, and then you can run your $("#myid2").tooltip() in callback function. :slightly_smiling_face: