How to add a tooltip to a div using JavaScript? Last Updated : 04 Apr, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report Adding tooltip to div element displays a pop-up, whenever the mouse hovers over div. Syntax: html < div title = "" > </div> <script> $(document).ready(function() { $('[data-toggle="tooltip"]').tooltip(); }); </script> Tooltip Methods: .tooltip("show"): It is used to show the tooltip. .tooltip("hide"): It is used to hide the tooltip. .tooltip(options): It is used to activate the tooltip. .tooltip("destroy"): It is used to destroy the tooltip. .tooltip("toggle"): It is used to toggle the tooltip. Tooltip Events: show.bs.tooltip: Tooltip is about to show on the screen. shown.bs.tooltip: Tooltip is fully shown on the screen. hide.bs.tooltip: Tooltip is about to hide. hidden.bs.tooltip: Tooltip is fully hidden. Return Value: It returns a pop-up when user hovers over the div element. Example 1: html <!DOCTYPE html> <html lang="en"> <head> <title> Bootstrap Example </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href= "https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script> <script src= "https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"> </script> </head> <body> <div class="container" title="ToolTip"> <h1 class="text-center "> GeeksforGeeks </h1> <h2 class="h4 text-center"> A Computer Science Portal for Geeks </h2> </div> <script> $(document).ready(function() { $('[data-toggle="tooltip"]').tooltip(); }); </script> </body> </html> Output: Before hovering over div: After hovering over div: Example 2: html <!DOCTYPE html> <html lang="en"> <head> <title> Bootstrap Example </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href= "https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script> <script src= "https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"> </script> </head> <body> <div class="container" title="Wonders of the World"> <h1 class="text-center "> GeeksforGeeks </h1> <h2 class="h4"> List of 7 Wonders of the World </h2> <ul> <li>Great Wall of China</li> <li>Petra</li> <li>The Colosseum</li> <li>Chichen Itza</li> <li>Machu Picchu</li> <li>Taj Mahal</li> <li>Christ the Redeemer</li> </ul> </div> <script> $(document).ready(function() { $('[data-toggle="tooltip"]').tooltip(); }); </script> </body> </html> Output: Before hovering over div: After hovering over div: Browser Support: Browsers which support Tooltip: Opera Internet Explorer Safari Google Chrome Firefox Comment More infoAdvertise with us Next Article How to create a Tooltip popup using jQuery Mobile ? R riarawal99 Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Questions Similar Reads How to Hide the Default Title When Using a Tooltip in JavaScript? The default browser tooltip is shown when a user hovers over an element with a title attribute. To hide this default title, you can use JavaScript to temporarily remove the title attribute while still implementing your custom tooltip.1. Temporarily Remove the Title AttributeThis method removes the t 2 min read How to add tooltip to an icon using Bootstrap ? In this article, we will see how to add tooltip element to an icon using Bootstrap. A Tooltip is used to provide interactive textual hints to the user about the element when the mouse pointer moves over. The tooltip is quite useful for displaying the description of different elements on the webpage. 2 min read How to create a bootstrap tooltip using jQuery ? Tooltip is like a balloon or also a small screen tip that displays text descriptions to any object in a webpage. A tooltip is displayed when the user hovers over an object using the cursor. It is a very useful part of a website and now can be found in almost all websites including some web applicati 4 min read How to create a Tooltip popup using jQuery Mobile ? jQuery Mobile is a web based technology used to make responsive content that can be accessed on all smartphones, tablets and desktops. In this article, we will be creating a Tooltip popup using jQuery Mobile. Approach: Add jQuery Mobile scripts needed for your project. <link rel=âstylesheetâ href 1 min read How to Create Link Tooltip Using CSS3 and jQuery ? Link tooltips are a great way to display extra information when an element or link is hovered on. There are several ways to do this. Using CSS and jQuery: The mousenter and mouseleave events are used in jQuery to perform this operation. html <!DOCTYPE html> <html> <head> <style 2 min read How to Add a Link in a HTML Tooltip ? Adding the link in the HTML tooltip involves embedding a hyperlink within the tooltip element, mainly used for user interaction such as hovering over a specific area. Below are the approaches to add a link in a HTML tooltip: Table of Content Using anchor TagAdd a link using JavaScriptUsing anchor Ta 3 min read Like