Help us make DevTools Tips better! Fill out this survey to tell us more about your DevTools habits and frustrations.
Get the selected element in the console
If you selected an element in the Elements panel (in Chrome, Safari, Polypane or Edge) or the Inspector panel (in Firefox), you can refer to it in the console using
This shortcut will return the DOM node instance, which you can then use to do things like getting computed styles, or check DOM properties, etc.
In Chrome, Polypane and Edge, the last 4 previously selected elements are additionally available as
$4. Learn more here.