---
name: "SelectorQuery.selectAll"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.10.0" }
title: "SelectorQuery.selectAll - Select all matching nodes"
---

## SelectorQuery.selectAll

> [VERSION] Base Library >= 2.10.0

### Description

Select all nodes matching the selector on the current page and return a NodesRef instance

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `selector` | `string` | Yes | Selector; supports ID selectors (#id) and class selectors (.class). |

### Return Value

Type: `NodesRef`

[NodesRef Object](/en/miniapp/develop/miniapp/api/tyml/NodesRef/NodesRef)

### Examples

#### Query multiple nodes

```html
// index.tyml
<view class="item">Node 1</view>
<view class="item">Node 2</view>
<view class="item">Node 3</view>
```

```js
// index.js
Page({
  onReady() {
    ty.createSelectorQuery()
      .selectAll('.item')
      .boundingClientRect((rects) => {
        rects.forEach((rect, index) => {
          console.log('Node ' + index, rect.width, rect.height);
        });
      })
      .exec();
  },
});
```

```css
// index.tyss
.item {
  height: 80rpx;
  background-color: #e8f4ff;
  margin-bottom: 10rpx;
}
```
