> For the complete documentation index, see [llms.txt](https://jscula.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jscula.gitbook.io/docs/manipulation/.some.md).

# .some()

Checks whether at least one item in a collection matches a condition.

Returns: `Boolean`

```javascript
const hasError = $('.field*').some(field => field.hasClass('error'));
```

### Use cases

Use `.some()` when any matching element can satisfy a condition:

* Check whether a form has a required empty field.
* Detect whether a menu item is currently active.
* Confirm that at least one result is visible.

### More examples

Check for an empty required input:

```javascript
const hasEmptyRequiredField = $('input*').some(input => {
  return input.attr('required') && !input.value();
});
```

Check whether any notification is unread:

```javascript
const hasUnreadNotification = $('.notification*').some(notification => {
  return notification.attr('data-read') === 'false';
});
```
