{
  "doc": {
    "id": "api/utilities/$",
    "title": "Cypress.$ | Cypress Documentation",
    "description": "Cypress automatically includes jQuery and exposes it as Cypress.$.",
    "section": "api",
    "source_path": "/llm/markdown/api/utilities/$.md",
    "version": "29b099a83033817a9072f7deec58409720b52bc4",
    "updated_at": "2026-05-03T15:21:58.370Z",
    "headings": [
      {
        "id": "api/utilities/$#cypress",
        "text": "Cypress.$",
        "level": 1
      },
      {
        "id": "api/utilities/$#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/utilities/$#usage",
        "text": "Usage",
        "level": 3
      },
      {
        "id": "api/utilities/$#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/utilities/$#selector",
        "text": "Selector",
        "level": 3
      },
      {
        "id": "api/utilities/$#notes",
        "text": "Notes",
        "level": 2
      },
      {
        "id": "api/utilities/$#cypress-vs-cy",
        "text": "Cypress.$ vs. cy.$$",
        "level": 3
      },
      {
        "id": "api/utilities/$#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "content": {
    "type": "root",
    "children": [
      {
        "type": "heading",
        "depth": 1,
        "children": [
          {
            "type": "text",
            "value": "Cypress.$"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Cypress automatically includes "
          },
          {
            "type": "link",
            "title": null,
            "url": "http://jquery.com",
            "children": [
              {
                "type": "text",
                "value": "jQuery"
              }
            ]
          },
          {
            "type": "text",
            "value": " and exposes it as `Cypress.$`."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "This is a great way to synchronously query for elements when debugging from Developer Tools."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Syntax"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "Cypress.$(selector)// other proxied jQuery methodsCypress.$.EventCypress.$.DeferredCypress.$.ajaxCypress.$.getCypress.$.getJSONCypress.$.getScriptCypress.$.post"
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Usage"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Correct Usage"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "Cypress.$('p')"
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Incorrect Usage"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "cy.$('p') // Errors, cannot be chained off 'cy'"
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Examples"
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Selector"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "const $li = Cypress.$('ul li:first')cy.wrap($li)  .should('not.have.class', 'active')  .click()  .should('have.class', 'active')"
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Notes"
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Cypress.$ vs. cy.$$"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "You can also query DOM elements with `cy.$$`. But `Cypress.$` and `cy.$$` are different."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "`Cypress.$` refers to the `jQuery` function itself. You can do anything with `Cypress.$` if you can do it with the `jQuery` function. So, both of the examples below work."
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "Cypress.$.each([1, 2, 3], (index, value) => {  expect(index).to.eq(value)}) // works"
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "$.each([1, 2, 3], (index, value) => {  expect(index).to.eq(value)}) // also works"
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "But `cy.$$` is a wrapper of the `jQuery.fn.init` function. In other words, you can only query DOM elements with `cy.$$`. Because of that, the jQuery utility functions like `jQuery.each`, `jQuery.grep` don't work with `cy.$$`."
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "cy.$$.each([1, 2, 3], (index, value) => {  expect(index).to.eq(value)}) // fails"
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "See also"
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/references/bundled-libraries.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "Bundled Libraries"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  "token_estimate": 261
}