---
title: "not() method in jQuery"  
description: "not() method in jQuery"  
author: "Ethan Karla"  
published: 2021-07-28  
updated: 2023-11-28  
canonical: https://www.mindstick.com/forum/156643/not-method-in-jquery  
category: "jquery"  
tags: ["jquery"]  
reading_time: 1 minute  

---

# not() method in jQuery

What is not() [method in jQuery](https://www.mindstick.com/forum/156655/trim-method-in-jquery)?

## Replies

### Reply by Aryan Kumar

In jQuery, the **not()** [method](https://www.mindstick.com/forum/166/webservice-method) is used to exclude elements from a selection. It allows you to filter out elements that don't match a specified criteria. Here's a simple example:

Let's say you have a list of items with different classes, and you want to select all items except those with a specific class, let's call it "exclude-class".

```plaintext
// Select all items except those with the class "exclude-class"
var selectedItems = $('.your-list-item-class').not('.exclude-class');

// Now, you can perform actions on the selected items
selectedItems.css('color', 'blue');
```

In this example, the **not('.exclude-class')** part ensures that elements with the class "exclude-class" are excluded from the selection. You can customize the criteria inside the **not()** method based on your specific needs.


---

Original Source: https://www.mindstick.com/forum/156643/not-method-in-jquery

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
