Inspect ElementLogo

JavaScript - Selecting Elements In The Console

September 11, 2019

The DevTools console provides you with shorterned element selectors to quicken your workflow.

Listed below are three variables and their explanations:

  1. $0 - $4 : A history of the five most recent DOM elements that you’ve selected in the elements panel, $0 being the last.
  2. $$() : A shortened version of document.querySelectorAll() which returns an array of the given CSS selector.
  3. $() : A shortened version of document.querySelector() which returns the first element, matching a given CSS selector.

Get tips in your inbox...

Inspect Element is a collection of Chrome Developer Tool tips learnt over time. From simple usability tips to complex JavaScript debugging.