Search code examples
javascriptgoogle-chrome

What is $$ and $x in Chrome Javascript console?


I saw Chrome's autocomplete suggestions when I was testing JQuery and saw $$ and $x are defined. What are they and where did they come from? I saw What is the variable $x used for in Chrome?, but what is $$?

> $
  function ( selector, context ) {
        // The jQuery object is actually just the init constructor 'enhanced'
        return new jQuery.fn.init( selector, context, rootjQuery );
    } jquery.js?body=1:62
> $$
  function $$() { [Command Line API] }
> $x
  function $x() { [Command Line API] }

This is something ogooglebar.


Solution

  • $$(selector):

    Returns an array of elements that match the given CSS selector. This command is equivalent to calling document.querySelectorAll().