I have some Javascript which displays an element on hover. I want to style this element and therefore need to trigger the hover state in the browser using Chrome Dev Tools.
This is easy to do with CSS where you can set the state of an element within Dev Tools. What is the best way to do this with Javascript?
Code Example:
$('#menu').hover( function() { console.log('test'); $('#dropdown').show(); }, function() { $('#dropdown').hide(); } );
To force an element into :hover state, right click it and select :hover . Additional tips on the elements panel in Chrome Developer Tools Shortcuts. Not sure when this changed, but you can now right click -> force element state (from the elements pane) on other elements (not just <a> elements) now.
Press the F12 function key in the Chrome browser to launch the JavaScript debugger and then click "Scripts". Choose the JavaScript file on top and place the breakpoint to the debugger for the JavaScript code.
Another alternative would be to hover over the element with your mouse and press F8 (this will only work in Chrome) to pause the script execution. The hover state will remain in visible to you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With