Reputation: 8366
I cannot find an element in the DOM with devtools.
The element appears only if I mouse over it's parent. In the code, on mouse over, with javascript, a lot of classes are added to different elements and only then my child element appears. (There are no hover events, only mouse over with js)
Because there are so many classes, I cannot add them manually. How can I inspect and debug elements in this context? Does Chrome provide any help?
Thanks!
Upvotes: 0
Views: 983
Reputation: 7236
If your event is attached like so:
document.getElementById('idOfYourElement').addEventListener('mouseover', function(){ console.log('hover'); })
,
you can trigger events programmatically like so:
document.getElementById('idOfYourElement').dispatchEvent(new Event('mouseover'))
.
If your mouse is outside the viewport it should stay in this state and you can debug in dev-tools.
Upvotes: 1
Reputation: 2725
Yes the Chrome devtools has the tool of handling hover/mouse over
element see image :
Upvotes: 0