---
id: api/commands/not
title: not | Cypress Documentation
description: Filter DOM element(s) from a set of DOM elements in Cypress.
section: api
source_path: docs/api/commands/not.mdx
version: 7ada28c0cd90e81cf56fd3fc73de6e6d45c16de6
updated_at: '2026-05-13T21:55:41.935Z'
---
# not

Filter DOM element(s) from a set of DOM elements.

Opposite of [`.filter()`](/llm/markdown/api/commands/filter.md)

The querying behavior of this command matches exactly how [`.not()`](http://api.jquery.com/not) works in jQuery.

## Syntax

```
.not(selector).not(selector, options)
```

### Usage

**Correct Usage**

```
cy.get('input').not('.required') // Yield all inputs without class '.required'
```

**Incorrect Usage**

```
cy.not('.icon') // Errors, cannot be chained off 'cy'cy.clock().not() // Errors, 'clock' does not yield DOM elements
```

### Arguments

**selector _(String selector)_**

A selector used to remove matching DOM elements.

**options _(Object)_**

Pass in an options object to change the default behavior of `.not()`.

| Option | Default | Description |
| --- | --- | --- |
| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |
| `timeout` | [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `.not()` to resolve before [timing out](#Timeouts) |

### Yields [Learn about subject management](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Subject-Management)

*   `.not()` yields the new DOM element(s) it found.
*   `.not()` is a query, and it is _safe_ to chain further commands.

## Examples

### Selector

#### Yield the elements that do not have class `active`

```
<ul>  <li>Home</li>  <li class="active">About</li>  <li>Services</li>  <li>Pricing</li>  <li>Contact</li></ul>
```

```
cy.get('ul>li').not('.active').should('have.length', 4) // true
```

## Rules

### Requirements [Learn about chaining commands](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Chains-of-Commands)

*   `.not()` requires being chained off a command that yields DOM element(s).

### Assertions [Learn about assertions](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Assertions)

*   `.not()` will automatically [retry](/llm/markdown/app/core-concepts/retry-ability.md) until the element(s) [exist in the DOM](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Implicit-Assertions).
*   `.not()` will automatically [retry](/llm/markdown/app/core-concepts/retry-ability.md) until all chained assertions have passed.

### Timeouts [Learn about timeouts](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Timeouts)

*   `.not()` can time out waiting for the element(s) to [exist in the DOM](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Implicit-Assertions).
*   `.not()` can time out waiting for assertions you've added to pass.

## Command Log

**_Find all buttons that are not of type submit_**

```
cy.get('form').find('button').not('[type="submit"]')
```

The commands above will display in the Command Log as:

When clicking on `not` within the command log, the console outputs the following:

## See also

*   [`.filter()`](/llm/markdown/api/commands/filter.md)
