I have not included jQuery file on my HTML page, but still $()
works in google chrome console and it is acting as a selector, why? However, functions of jQuery are not working, but I want to know that why $()
is working on google chrome console?
Asked
Active
Viewed 56 times
2

Wesley Coetzee
- 4,768
- 3
- 27
- 45

ashish7249
- 269
- 3
- 7
1 Answers
6
Chrome devtools define set of useful shortcuts to query DOM. Those include $
and $$
. From the docs:
$(selector) returns the reference to the first DOM element with the specified CSS selector. This function is an alias for the document.querySelector() function.
Similarly, $$(selector)
is the alias to document.querySelectorAll(selector)
method.
So it has nothing to do with jQuery and they will only work in developer console.

dfsq
- 191,768
- 25
- 236
- 258