Reputation: 4595
I am trying to view, through Chrome's developer tools, how tooltips are structured on a site. However, even when I am hovered over the item, when I "inspect element", nothing shows for the tooltip in the html. I know I can set the Style to :hover
, but I still can't see the html or css of the tooltip.
Any ideas?
Upvotes: 210
Views: 174847
Reputation: 11900
F8 will pause debugging.
You may need to have the 'Sources' tab of the developer tools open.
Mouse over the tooltip, and press F8 while it is displayed.
You can now use the inspector to look at the CSS.
Upvotes: 248
Reputation: 11
Chrome dev tools. In elements right click on the button you want to show the tooltip or hover element. There is an option to force whatever state you want. Go to For State :hover
Upvotes: 1
Reputation: 611
I once had issue with a JS generated tooltip. I paused the chrome debugger using f8, however, the element was unreachable, as it was a tooltip for a Qlik Sense map, so a lot of items are appearing under it. I have done a simple workaround. While the sources are displayed on the right, I started right clicking on each div and deleting it from the inspector, till I found the div. Hope this helps.
Upvotes: 0
Reputation: 1
some tooltips disappeared when we open the inspect part on hover mode, sometimes they don't disappear when change responsive tab (active or inactive button). then you can right click and get inspect from it.so easily.
Upvotes: 0
Reputation: 91
Land in this post for answers and find eventually a way to do it. Inspect the parent element of tooltip and set break on subtree change and hover your mouse on element and click F8 till the tooltip appear. You can have your tooltip and check the styling.
Upvotes: 4
Reputation: 123610
For me, the accepted answer didn't work: clicking in DevTools immediately closed the ToolTip.
However, I found https://superuser.com/questions/249050/chrome-keyboard-shortcut-to-pause-script-execution which helped me:
const F12 = 123
window.addEventListener('keydown', function(event) {
if (event.keyCode === F12 ) {
debugger;
}
});
Highlight element with inspector
Hit F12
You can now inspect the element, with JavaScript paused so the DOM won't change.
Upvotes: 41
Reputation: 1
I found a good way I was struggling with this : • Open Elements Tab • Inspect an element on the page , should be close to the element that you are trying to inspect • Hover over the tooltip • While the dev/Elements tab is open Hit Ctrl F to move the focus to Text area in element tab where it Says Find by string , selector , or Xpath • use the keyboard key to navigate up/down the elements till you will get to the elements that you are looking for , dont touch your mouse
Upvotes: 0
Reputation: 569
Upvotes: 2
Reputation: 244
just hit one line script in console and press any key to enter in debug mode.
window.onkeydown = () => { debugger }
Upvotes: 5
Reputation: 61
Hover over the element, press F8 for little longer, it will pause script execution.
Upvotes: 6
Reputation: 685
Here is how I did it on Mac:
Cmd+Shift+P
worked for me.Disable JavaScript
and press Enter
This will prevent from fading all the tooltips that utilize JavaScript.
Upvotes: 6
Reputation: 1
Hit command-option-j
to open the console. Click the window-looking button on the top right corner of the console to open the console in a different window.
Then, in the Chrome window, hover over the element that triggers the popover, hit command-
however many times you need to focus on the console, then type debugger
. That'll freeze the page; then you can inspect the element in the Elements tab.
Upvotes: 0
Reputation: 365
Another Solution I found for this problem. Through Mobile or Tablet view in Chrome press Crt + Shift + M in Chrome Dev tools for Mobile view in Chrome. Click(Tap) on ToolTip div and you can inspect it with Right Click on tooltip
Upvotes: 0
Reputation: 125
it is so simple to edit these tooltips.
Step 1: Inspect the element that has the tooltip. Make sure it is highlighted with blue in devtools.
Step 2: right-click on the element (in devtools part) and select: attribute modifications, under Break on
Step 3: Hover over the inspected element and a gray overlay will appear over the site with a small text: Paused in debugger
at the top of your screen
Step 4: Click on the blue arrow until the hover state is selected.
Step 5: Inspect and edit the tooltip
Upvotes: 11
Reputation: 15
One of the easiest ways I found is:
Open Chrome dev tools on the side
Hover over element
Right-click
Click on dev tools
Now you can inspect and change styles
Upvotes: -3
Reputation: 3649
Click f12
go to the console tab and add the following:
setTimeout(()=> {debugger},5000)
This will give you 5 seconds to do whatever you want and it will break at 5 seconds
. Then you can inspect the target element
(ex. hover the element and wait 5 seconds then inspect..)
Upvotes: 114
Reputation: 69
Follow these steps
Open Inspect
window in chrome.
Place the mouse over the tooltip.
Press F8
JS execution will be paused and then you can inspect the tooltip.
Press F8 again to start execution and F10 to debug.
Upvotes: 6
Reputation: 227
The dev tools provides a way to inspect a hovered element like a tooltip.
1 - Open the dev tools using F12.
2 - Select "Elements" tab.
3 - Select the parent element that contains the tooltip.
4 - Click on "..." (on the line of the parent element) and after select "Break on"/"subtree modifications" (see image below)
5 - Finally go back to application and make the Tooltip shows up. It should block the execution after the Tooltip gets visible
Hope it can be useful for someone!
Upvotes: 2
Reputation: 2306
Single window answer, with no coding
None of the other answers are quite right, or have enough detail, so here's my attempt.
<div>
in the <body>
Upvotes: 39
Reputation: 157
1)Open the Inspect window by clicking F12
2)Go to source tab(next to console)
3)Now hover on element to be inspected and keep your mouse over there.
4)Using keyboard(Tab or shift+tab) to move the control to pause button or F8Refer the image
5)When keyboard focus is on Play button. Hit enter. Your hover element will be freezed you can do anything now
Upvotes: 3
Reputation: 1137
No code solution for JS activated tooltips:
With Chrome's devtools inspect the containing / parent element of the tooltip. In the "elements" tab, right click on that container DOM element then choose "break on" > "subtree modifications". The next time you hover over the part of the DOM the tooltip is housed in, the JS code will be paused allowing you to inspect the contents of the tooltip.
Upvotes: 7
Reputation: 13125
You would just need to force the tooltip to show as such
$('.myelement').tooltip('open');
Now the tooltip will show regardless of hovering state.
Scroll down near the bottom of the DOM where you should see the markup.
Update see cneuro's comment for Bootstrap 3.
$('.myelement').tooltip('show');
Update see Marko Grešak's answer for Chrome and apparently Safari as well, $0
can be used as a shortcut for the currently selected element. This appears to work in Safari as well.
$($0).tooltip('show')
Upvotes: 70
Reputation: 41
For some reason the answers provided here weren't working for me on Windows. I was able to inspect the tooltip by opening the dev tools, then hovering over the element that brings up the tooltip, then right clicking on that element (not the tooltip). Then, move the cursor over into the inspector panel and scroll down to the bottom. The tooltip element should still be there.
Upvotes: 0
Reputation: 81
In Chome on Linux this can be achieved for JS generated tooltips such as those for references on WikiPedia by doing the following:
As stated above, open the dev tools using F12. Open them in another window. Highlight the tooltip and click Ctrl-Shift-C (The HTML Inspector). As you move over the tip, the dev window will show the appropriate section.
If you need to keep the tip open when you mouse off it, to be able to inspect it in the other window more thoroughly, then right click on the tooltip and leave the context menu up, and click on the the dev tools window. In this scenario it leaves the tip up in the wikipedia window.
To a degree it also works with bootstrap tips.
Upvotes: 0
Reputation: 6703
Worth noting that toggling the :hover state from within the dev tools only has an impact if the hint text is enabled via CSS :hover rules in the first place. The toggle only applies the hover state to the element for rendering purposes, but does not trigger a corresponding JavaScript mouseover event.
Many frameworks such as AngularJS dynamically attach tooltip HTML to the bottom of the document body via JavaScript when a target element is hovered, so any amount of hovering and inspecting the target element won't help.
@joeyyang's answer worked very well for me in this scenario.
Upvotes: -1
Reputation: 1183
This solution works without any extra code.
Hit command-option-j
to open the console. Click the window-looking button on the top right corner of the console to open the console in a different window.
Then, in the Chrome window, hover over the element that triggers the popover, hit command-`
however many times you need to focus on the console, then type debugger
. That'll freeze the page, then you can inspect the element in the Elements tab.
Upvotes: 95
Reputation: 13127
Here’s a simple solution: If you have dynamic tooltips, you can make them “persistent” by (temporarily) changing the trigger event to click
. This will have the effect that the tooltip only disappears on a click-out:
$('body').tooltip({
selector: "[data-toggle='tooltip']",
trigger: "click"
});
This way, it can be easily inspected with FF’s or Chrome’s debugging tools.
Upvotes: 3
Reputation: 206
I had problems with this so I went to the documentation and inspected the tooltip that is already rendered on the page. That helped me see the dom structure of the tooltip and edit it accordingly.
Upvotes: 0
Reputation: 2037
I actually found a trick to do that with the Twitter Bootstrap tooltips. If you open the dev tools (F12) on another monitor, then hover over the element to bring up the tooltip, right click as if you were to select 'Inspect Element'. Leaving that context menu open, move the focus over to the dev tools. The html for the tooltip should show up next to the element its a tooltip for in the HTML. Then you can look at it as if it were another element. If you go back to Chrome the HTML disappears so just something to be aware of.
Kind of a weird way but it worked for me so I figured I would share it.
Upvotes: 118