When we type $
in chrome console it returns a function. I am sure it\'s not jQuery\'s $
.
If I want to use jQuery in console, What is the best way
$
is an alias for document.querySelector. In the same vein there is $$ which is an alias for document.querySelectorAll.
It is defined in the Command line (console) api.
The Command Line API contains a collection of convenience functions for performing common tasks: selecting and inspecting DOM elements, displaying data in readable format, stopping and starting the profiler, and monitoring DOM events.
If you have $
defined on the page as a global (perhaps by using jQuery), you'll get that global, not the command-line built-in.
There are other handy functions defined there.
To run jQuery, without having it in the page source code, you may find Chrome extensions to be handy, or simply copy-paste the jQuery source code in the console.