DevExtreme v24.1 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

JavaScript/jQuery Tooltip

The JavaScript Tooltip component can display a tooltip for an element on the page. To bind the JavaScript Tooltip to an element, use the target property.

DevExtreme Accessibility Compliance
DevExtreme component libraries meet a variety of WCAG and Section 508 compliance standards. To assess this demo’s accessibility level, click the Run AXE® Validation button to launch the AXE® web accessibility evaluation tool.
All trademarks or registered trademarks are property of their respective owners. AXE® Terms of Use
The overall accessibility level of your application depends on the Tooltip features used.
Backend API
$(() => { $('#tooltip1').dxTooltip({ target: '#product1', showEvent: 'mouseenter', hideEvent: 'mouseleave', hideOnOutsideClick: false, }); $('#tooltip2').dxTooltip({ target: '#product2', showEvent: 'mouseenter', hideEvent: 'mouseleave', hideOnOutsideClick: false, position: 'right', contentTemplate(data) { data.html("<img alt='SuperPlasma 50' width='150' src='../../../../images/products/3.png'><br/><b>SuperPlasma 50</b><br/>2400$"); }, }); $('#tooltip3').dxTooltip({ target: '#product3', showEvent: 'mouseenter', hideEvent: 'mouseleave', hideOnOutsideClick: false, position: 'top', animation: { show: { type: 'slide', from: { top: -100, opacity: 0, }, to: { opacity: 1, top: 0, }, }, hide: { type: 'pop', from: { scale: 1, opacity: 1, }, to: { opacity: 0, scale: 0.1, }, }, }, }); });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/24.1.7/css/dx.light.css" /> <script src="js/dx.all.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div class="form"> <div class="label">Default mode</div> <div> <img alt="ExcelRemote IR" id="product1" src="images/products/17.png" /> <div id="tooltip1">ExcelRemote IR</div> </div> <div class="label">With template</div> <div> <img alt="SuperPlasma 50" id="product2" src="images/products/3.png" /> <div id="tooltip2"></div> </div> <div class="label">With animation</div> <div> <img alt="Projector PlusHD" id="product3" src="images/products/15.png" /> <div id="tooltip3">Projector PlusHD</div> </div> </div> </div> </body> </html>
.form { padding: 20px; } .form img { width: 100px; margin: 10px 0 30px; } .label { font-size: 16px; }

Show and Hide the JavaScript Tooltip

To show and hide the JavaScript Tooltip in response to certain events, specify the showEvent and hideEvent properties. These properties can accept multiple events at once as well as an object.

To hide the JavaScript Tooltip when a user clicks outside its borders, use the hideOnOutsideClick property.

Customize and Animate the JavaScript Tooltip

Assign the JavaScript Tooltip's content in the HTML markup. Alternatively, you can use the content template to customize the JavaScript Tooltip's content.

If you need to position the JavaScript Tooltip at a certain side of the target element, specify the position property.

To animate the JavaScript Tooltip, declare the animation object. In this object, specify the show and hide fields.