All Chromium-based browsers (Google Chrome, Microsoft Edge, etc) have a set of utility functions in the Developer Tools console window - this includes $()
as an alias of querySelector
, which has the same name as jQuery's $
(jQuery
) object.
They are documented here: https://developers.google.com/web/tools/chrome-devtools/console/utilities
$_
$0
$1
$2
$3
$4
$
$$
$x
clear
copy
debug
dir
dirxml
inspect
getEventListeners
keys
monitor
monitorEvents
profile
queryObjects
table
undebug
unmonitor
unmonitorEvents
values
- Note that these utility functions cannot be used from page scripts (
<script>
): they can only be used in the Developer Tools console.
- If a page does include a function with the same name as a Developer Tools utility function then the page's functions take precedence over the utility functions
- So if a page uses jQuery, then
$
will be jQuery's, not Chrome's.
This is not the same as the console.
API, like console.log
, console.error
, etc, which are part of the browser API.