css - How to find an event listener in Chrome Dev Tools? -


i know hovering on element causes element new class added it. how check , eventlistener on chrome? event listeners tab in chrome list listeners on document instead of specific element.

to view event listeners single element have selected, make sure uncheck 'ancestors' box in event listeners tab. if checked, see event listeners ancestors of element - may seeing now.

hovering doesn't add class element, triggers hover state element can targeted css pseudo-class selector. not event listener there event listeners can added detect mouse pointer on element (see end of answer). here example of targeting hover state of paragraph tag :hover pseudo-class selector:

 p:hover {        background: blue;        color: white;      }
<p>hover me</p>  <p>or hover me</p>

in chrome devtools, can force hover state on element view hover state behavior. click :hov button @ top right of styles pane, , check :hover box. if there pseudo-class :hover styling rules element, displayed in styles pane , element change accordingly in viewport.

there event listeners such 'mouseover' , 'mouseout' which, when used together, emulate hover state behavior. note, however, these independent of hover state - forcing hover state in devtools not cause these event listeners trigger. if these event listeners present on element inspecting, show in event listeners tab - remember uncheck 'ancestors' box if inspecting page lot of event listeners.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -